react-native-context-menu-view
react-native-context-menu-view copied to clipboard
Gesture conflict on Android
When there is a ContextMenu in which there is a Pressable component, after releasing a finger long press Pressable or TouchebleOpacity is triggered, which is inside <ContextMenu/>
Platform: Only Android.
Example Code
<ContextMenu
actions={[{title: 'Title 1'}, {title: 'Title 2'}]}
onPress={e => {
console.warn(
`Pressed ${e.nativeEvent.name} at index ${e.nativeEvent.index}`,
);
}}>
<TouchableOpacity
onPress={() => {console.log("Image opened")}}
style={{backgroundColor: 'green', borderRadius: 30, padding: 20}}>
<Text>Open image</Text>
</TouchableOpacity>
</ContextMenu>
Gif Reproduce Video Reproduce https://user-images.githubusercontent.com/46076319/149196136-56d23215-9f3d-43c6-a4d9-4f724add763f.mov
How can I fix it? @maartenvanvliet @alessandrod @mpiannucci @jacobp100 @mrousavy
found a workaround, add to Pressable or TouchebleOpacity.
onLongPress={() => return null}
Leaving this up for posterity
i have other problem, im using ImageModel to show image, sometime when context menu showed the image is show as transparent
Just to clarify, is this issue staying up because we should use the workaround, or will there be an expected fix? I maintain a library that wraps this one (zeego), so I just want to know if I should include this workaround in the docs. Thanks!
I have left this up because the workaround works for people. I have not personally tested it on android so it isnt fixed yet.
If the workaround is solid i would be happy to review and test a PR
I have the same problem on ios and I have already added
onLongPress={() => null}