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

Gesture conflict on Android

Open BLOCKMATERIAL opened this issue 2 years ago • 6 comments

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 ezgif-5-2308a0b239 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

BLOCKMATERIAL avatar Jan 12 '22 18:01 BLOCKMATERIAL

found a workaround, add to Pressable or TouchebleOpacity. onLongPress={() => return null}

BLOCKMATERIAL avatar Feb 10 '22 21:02 BLOCKMATERIAL

Leaving this up for posterity

mpiannucci avatar Apr 18 '22 19:04 mpiannucci

i have other problem, im using ImageModel to show image, sometime when context menu showed the image is show as transparent

fukemy avatar Apr 22 '22 05:04 fukemy

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!

nandorojo avatar Oct 17 '22 18:10 nandorojo

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

mpiannucci avatar Oct 17 '22 18:10 mpiannucci

I have the same problem on ios and I have already added onLongPress={() => null}

FernandoLooplan avatar Feb 23 '24 10:02 FernandoLooplan