enesozturk / react-native-hold-menu

📱 A performant, easy to use hold to open context menu for React Native powered by Reanimated 🚀
https://enesozturk.github.io/react-native-hold-menu/
MIT License
1.4k stars 91 forks source link

Cannot navigate onPress #69

Open jameskim917 opened 2 years ago

jameskim917 commented 2 years ago
<HoldItem
            items={[
              { text: 'Edit', icon: 'pencil', onPress: (term, definition) => { navigation.navigate('EditWord', { term, definition }) } },
              { text: 'Delete', icon: 'trash', isDestructive: true, onPress: () => { } }
            ]}
            actionParams={{ Edit: [word.term, word.definition] }} bottom={true}
>

onPress is unable to navigate to another screen

enesozturk commented 2 years ago

I am able to use the navigation on both Android and iOS. Here is the demo.

const { goBack } = useNavigation();

const items = [
    {
      text: 'Home',
      icon: 'home',
      onPress: () => {
        goBack();
      },
    }
]

https://user-images.githubusercontent.com/19428358/179858074-bf68d476-9398-4dee-9025-fbe236fd154d.mov

Do you think you're calling the navigation in the right place? Cannot repro and guess the problem with the current code snippets.