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

Pressables not working after context menu opened

Open mrousavy opened this issue 5 years ago • 6 comments

When wrapping Pressables (<Pressable>, <TouchableOpacity>, ...) with a context menu, the entire JS responder system will fail/crash once you open the context menu once. In other words, your entire screen becomes unresponsive if you open a context menu that contains a pressable.

There might be some extra treatment required to support inlining the JS pressability API.

(Also, it looks like native buttons such as the back button from react-native-navigation are still working, it's just the current screen that "freezes"/doesn't trigger onPress events anymore)

https://user-images.githubusercontent.com/15199031/104899395-14d0a680-597b-11eb-9d4e-c851136042f7.mov

Code:

return (
  <View style={styles.container}>
    <ContextMenu onPress={onContextActionPressed} actions={ACTIONS}>
      <Pressable style={styles.imageContainer} onPress={onImagePressed}>
        <FastImage
          style={styles.image}
          source={imageSource}
        />
      </Pressable>
    </ContextMenuView>
  </View>
);

mrousavy avatar Feb 11 '21 11:02 mrousavy

Whoa I'll have to check this out for sure. Thanks for the bug report!

mpiannucci avatar Feb 12 '21 03:02 mpiannucci

i have same problem, did u solved this?

fukemy avatar Apr 22 '22 05:04 fukemy

Still happens sometimes

margox avatar Jun 28 '23 23:06 margox

Still happens sometimes

try to use rn ios context menu view its much better

fukemy avatar Jun 29 '23 01:06 fukemy

I think this is because the native UIControl hijacks the press event no matter what on iOS. Not sure tho

mpiannucci avatar Nov 25 '23 16:11 mpiannucci

Still happens. Also here is error message that follows this behavior (if you are trying to navigate somewhere after screen freezing)

[UIKitCore] Attempt to present <RNSScreen: 0x109f44000> on <UIViewController: 0x109233270> (from <RNScreensNavigationController: 0x10b178000>) which is
already presenting <_UIContextMenuActionsOnlyViewController: 0x108307e30>.

tn avatar Feb 02 '24 18:02 tn