dominicstop / react-native-ios-context-menu

A react-native component to use context menu's (UIMenu) on iOS 13/14+
MIT License
572 stars 29 forks source link

[Android] TouchableOpacity activates when releasing after long press to open ContextMenu #109

Closed fredrikburmester closed 1 month ago

fredrikburmester commented 1 month ago

As the title says, upon releasing my finger after long-pressing an item to open the context menu the TouchableOpacity activates and the onPress action ()handleOpenFile) is executed.

Example code:

    <ContextMenu.Root>
      <ContextMenu.Trigger>
        <TouchableOpacity
          onPress={handleOpenFile}
        >
          <Text>Text</Text>
        </TouchableOpacity>
      </ContextMenu.Trigger>
      <ContextMenu.Content
        loop={false}
        alignOffset={0}
        avoidCollisions={true}
        collisionPadding={0}
      >
          <ContextMenu.Item
            key={"1"}
            onSelect={() => {}}
          >
            <ContextMenu.ItemTitle style={{ color: "red" }}>
              1
            </ContextMenu.ItemTitle>
          </ContextMenu.Item>
      </ContextMenu.Content>
    </ContextMenu.Root>

The expected behavior should be that he underlying TouchableOpacity does not activate.

This is only an issue on Android it seems.

fukemy commented 1 month ago

this library not working on Android, use other lib instead

fredrikburmester commented 1 month ago

What is the "other lib"?

nandorojo commented 1 month ago

React Native Menu, https://zeego.dev wraps each one for you

nandorojo commented 1 month ago

If you’re having an issue on Android with Zeego, you should open an issue at @react-native-menu

nandorojo commented 1 month ago

The expected behavior should be that he underlying TouchableOpacity does not activate.

Why? I don’t exactly agree. Why have a Pressable that shouldn’t activate?

nandorojo commented 1 month ago

Oh sorry, I see, this is the context menu

nandorojo commented 1 month ago

@fredrikburmester i think we can move this issue to the zeego repo and possibly tag the react-native-menu issue as well since it’s Android