react-native-ios-context-menu icon indicating copy to clipboard operation
react-native-ios-context-menu copied to clipboard

How to open ContextMenuButton with single tap

Open FrankFundel opened this issue 4 years ago • 2 comments

Yeah how to open the ContextMenu without holding the Button? :)

FrankFundel avatar Jan 29 '21 22:01 FrankFundel

You need to set isMenuPrimaryAction to true (Check out ContextMenuButton props)

guytepper avatar Feb 16 '21 09:02 guytepper

That's true for iOS 14.

However,

Note that ContextMenuButton is only available on iOS 14 and above. On iOS 13, it will use a ContextMenuButton, and on iOS 12 and below, it will use the ActionSheetFallback module to present a ActionSheetIOS menu.

With that, on iOS 13, you have to long press to show the menu. My design team wished instead of a long press, a single tap should also trigger the action sheet. So i used ActionSheetFallback Module as provided,

const actionSheetMenu = async () => await ActionSheetFallback.show(pullDownMenuConfig);

return (
<TouchableOpacity onPress={() => actionSheetMenu()}>
   <Text>ActionSheet Fallback with a tap</Text>
</TouchableOpacity>
);

so far it is working.. 🤞🏻 without any problems nor warnings 🤞🏻 . hope this helps!

⭐ Great work @dominicstop on the library and documentations. ⭐ I really like this library and the way how it is implemented. I don't have to have spent hours to figure how to make this accessible! awesome!

und3f1n3d avatar Feb 18 '21 21:02 und3f1n3d

You can use the ContextMenuView.

nandorojo avatar Oct 16 '23 16:10 nandorojo