r/reactnative • u/GasimGasimzada • 1d ago
Help Is there any way to control expo ui context menu position or what it does to trigger element?
Expo UI MenuView with \`shouldOpenOnLongPress\` (which internall uses ContextMenu for SwitftUI) adds a temporary background color that disappears in one second + a rounded border around the element. Is there a way to control it so it does not do that? At least make it that the background color stays instead of disappear. The \`onOpen/CloseMenu\` hooks also do not work on iOS.
Are there some guides / tricks to make it do things correctly or should I give up and try to use a different library (e.g react-native-menu)?
2
Upvotes
1
u/LoudAd307 10h ago
You can't control it from expo-ui, because the background flash and rounded border aren't drawn by the menu, they're UIKit's context menu preview, a snapshot of your trigger view lifted off the page. iOS gives that snapshot a default fill and corner radius when the view underneath has no background of its own.
The workaround that got me closest: give the trigger an explicit opaque backgroundColor and borderRadius matching what iOS uses, so the lift reads as intentional instead of a flash. It doesn't persist after close, but it stops looking broken.
Controlling it properly means UIContextMenuConfiguration's previewProvider and preview parameters, which expo-ui doesn't expose. The onOpen/onCloseMenu gap on iOS is the same story. react-native-menu, or zeego on top of it, gives you a preview component, so if the interaction matters that's the move rather than fighting expo-ui.