about summary refs log tree commit diff
path: root/src/components/Menu/index.web.tsx
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-12-12 11:50:29 -0800
committerGitHub <noreply@github.com>2024-12-12 13:50:29 -0600
commit2276cb0e75356779d175e40550469c8c04a7e69a (patch)
tree74837e1d6c65ccc997dda221a29d9d68f77979ba /src/components/Menu/index.web.tsx
parent2808f8b73da4791e0f3cb85b03403738e5bf6b63 (diff)
downloadvoidsky-2276cb0e75356779d175e40550469c8c04a7e69a.tar.zst
Fix share button not working for some users (#5849)
* fix share button

* Revert "fix share button"

This reverts commit 3521c241729dc9bbe3dd7b62fc6e3e61e011cdf9.

* tweak

* Clean up context

---------

Co-authored-by: Eric Bailey <git@esb.lol>
Diffstat (limited to 'src/components/Menu/index.web.tsx')
-rw-r--r--src/components/Menu/index.web.tsx19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/components/Menu/index.web.tsx b/src/components/Menu/index.web.tsx
index 37ad67e29..ab0c9d20a 100644
--- a/src/components/Menu/index.web.tsx
+++ b/src/components/Menu/index.web.tsx
@@ -7,7 +7,12 @@ import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
 import {atoms as a, flatten, useTheme, web} from '#/alf'
 import * as Dialog from '#/components/Dialog'
 import {useInteractionState} from '#/components/hooks/useInteractionState'
-import {Context, ItemContext} from '#/components/Menu/context'
+import {
+  Context,
+  ItemContext,
+  useMenuContext,
+  useMenuItemContext,
+} from '#/components/Menu/context'
 import {
   ContextType,
   GroupProps,
@@ -40,10 +45,6 @@ export function useMenuControl(): Dialog.DialogControlProps {
   )
 }
 
-export function useMemoControlContext() {
-  return React.useContext(Context)
-}
-
 export function Root({
   children,
   control,
@@ -110,7 +111,7 @@ const RadixTriggerPassThrough = React.forwardRef(
 RadixTriggerPassThrough.displayName = 'RadixTriggerPassThrough'
 
 export function Trigger({children, label, role = 'button'}: TriggerProps) {
-  const {control} = React.useContext(Context)
+  const {control} = useMenuContext()
   const {
     state: hovered,
     onIn: onMouseEnter,
@@ -203,7 +204,7 @@ export function Outer({
 
 export function Item({children, label, onPress, ...rest}: ItemProps) {
   const t = useTheme()
-  const {control} = React.useContext(Context)
+  const {control} = useMenuContext()
   const {
     state: hovered,
     onIn: onMouseEnter,
@@ -262,7 +263,7 @@ export function Item({children, label, onPress, ...rest}: ItemProps) {
 
 export function ItemText({children, style}: ItemTextProps) {
   const t = useTheme()
-  const {disabled} = React.useContext(ItemContext)
+  const {disabled} = useMenuItemContext()
   return (
     <Text
       style={[
@@ -279,7 +280,7 @@ export function ItemText({children, style}: ItemTextProps) {
 
 export function ItemIcon({icon: Comp, position = 'left'}: ItemIconProps) {
   const t = useTheme()
-  const {disabled} = React.useContext(ItemContext)
+  const {disabled} = useMenuItemContext()
   return (
     <View
       style={[