react-native-hold-menu icon indicating copy to clipboard operation
react-native-hold-menu copied to clipboard

Menu list items are pressable after close

Open SohelIslamImran opened this issue 2 years ago • 14 comments

Describe the bug When you first time open manu, the area of where the menu list items were opened, are pressable. Menu is hidden, But still can press the menu items. Can't understand what is the problem .. Please fix.

Package versions "react": "17.0.2", "react-native": "0.68.2", "react-native-reanimated": "~2.8.0", "react-native-hold-menu": "^0.1.5", "expo": "^45.0.6",

SohelIslamImran avatar Jul 20 '22 21:07 SohelIslamImran

@enesozturk

SohelIslamImran avatar Jul 20 '22 21:07 SohelIslamImran

I think you need to minus (-) zindex of menu, when close/inactive

SohelIslamImran avatar Jul 20 '22 21:07 SohelIslamImran

Another problem found @enesozturk , items props on HoldItem component are not changing, it kept memorized. So it is causing problems with multiple HoldItem on multiple screens. When I open a hold menu and then go to another screen and open another hold menu, it keeps the previous items, not showing this new menu items.

SohelIslamImran avatar Jul 21 '22 21:07 SohelIslamImran

Unfortunately, this package is not working as expected and as shown in the documentation, examples and gif. So sad☹️.

SohelIslamImran avatar Jul 21 '22 21:07 SohelIslamImran

This is indeed unexpected and I cannot reproduce the same issue you recorded. Do you get the same with all the use cases? Which version are you using?

items props on HoldItem component are not changing

This was one of the old issues and I remember it's solved. When I run the example on the same device (It's Expo, so would be easy to test), I cannot see the same issue between the examples.

enesozturk avatar Jul 23 '22 17:07 enesozturk

Alright. But let's quick fix the first and main issue. (The Menu list items pressable issue on android) @enesozturk

SohelIslamImran avatar Jul 23 '22 18:07 SohelIslamImran

This is indeed unexpected and I cannot reproduce the same issue you recorded. Do you get the same with all the use cases? Which version are you using?

items props on HoldItem component are not changing

This was one of the old issues and I remember it's solved. When I run the example on the same device (It's Expo, so would be easy to test), I cannot see the same issue between the examples.

Actually, I found the exact issue. The deepEqual in react-native-hold-menu\src\components\menu\MenuList.tsx are returning true, even they are not equal. Please check and fix the deepEqual. @enesozturk image

Mainly, this condition is not working on React native. It always returns true even if functions are not equal.

image

SohelIslamImran avatar Jul 23 '22 21:07 SohelIslamImran

Please try to fix these two issues ASAP @enesozturk 🙏🙏!!

SohelIslamImran avatar Jul 23 '22 21:07 SohelIslamImran

In browser or node, function.toString() convert the function body to string. Like this

image

But in React Native, it always converts to this. So the equal (===) condition always returns true.

image

Is it clear? @enesozturk

SohelIslamImran avatar Jul 23 '22 21:07 SohelIslamImran

I found this issue https://github.com/facebook/hermes/issues/114 and https://github.com/facebook/hermes/issues/612#issuecomment-1181514087

SohelIslamImran avatar Jul 23 '22 21:07 SohelIslamImran

Bump. Waiting

SohelIslamImran avatar Jul 25 '22 16:07 SohelIslamImran

In browser or node, function.toString() convert the function body to string. Like this

image

But in React Native, it always converts to this. So the equal (===) condition always returns true.

image

Is it clear? @enesozturk

I console logged normal function. It is showing the function body. The reason of the above issue is you used useSharedValue for store items. I think you need to use react state or context. @enesozturk

image

SohelIslamImran avatar Jul 26 '22 18:07 SohelIslamImran

@enesozturk Can you please fix these issues ASAP? My app is buggy for this package now. Or instead, I should find another package?

SohelIslamImran avatar Jul 27 '22 19:07 SohelIslamImran

Hi I encountered this issue also on Android 11 Area where menu was remains tappable

I use latest version of the lib

UPD. Created PR for this

https://github.com/enesozturk/react-native-hold-menu/pull/115

kesha-antonov avatar Jan 08 '24 11:01 kesha-antonov