react-native-ios-context-menu
react-native-ios-context-menu copied to clipboard
Open a context menu programmatically
Hey @dominicstop! I'm really enjoying this library, thanks so much for your work on it! I think one great thing to add would be the ability to open a context menu programmatically/imperatively. The API could be something like this:
const event = await UIContextMenu.open(exampleNodeId, menuConfig)
Or
UIContextMenu.open(exampleNodeId, menuConfig, event => {
// Handle menu item press event
})
What do you think? 😎
+1
I think a better API would be:
const ref = useRef()
const onPress = () => ref.current?.open()
return <ContextMenuView ref={ref} />
Much needed
iOS does not allow this for context menus, so I think it's worth closing.