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

Error: Value is undefined, expected an Object

Open wissehes opened this issue 3 years ago • 7 comments

Describe the bug When pressing an option in the menu with an onPress I get this error:

Error: Value is undefined, expected an Object
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:171:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
at node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:12:21 in ErrorUtils.setGlobalHandler$argument_0
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue

This is my code:

<HoldItem
  items={[
    { text: "Test", onPress: () => {}, isTitle: false },
    { text: "Reply", onPress: () => console.log("hi") },
    { text: "A (no onPress)", isDestructive: true },
  ]}
  containerStyles={{ width: "100%", alignItems: "center" }}
>
  <HomePageButton
    text="test"
    onPress={() => null}
    style={{ alignSelf: "center" }}
  />
</HoldItem>

To Reproduce Steps to reproduce the behavior:

  1. Install react-native-hold-menu
  2. Create a menu with an item with onPress: () => {}

Expected behavior I of course expect it to not error and just run the onPress function.

Actual behavior When I press an item that has an onPress function, I get an error. If it doesn't have the onPress function, I don't.

https://user-images.githubusercontent.com/31771656/118395775-744e7280-b64c-11eb-8296-d973069a2391.mov

Screenshots Error on my phone: image

Package versions

  • React: 16.13.1
  • React Native: 0.64
  • React Native Reanimated: 2.1.0
  • React Native Hold Menu: 0.0.8
  • Expo: 41

Additional context

This also happens on android.

wissehes avatar May 16 '21 11:05 wissehes

I'm getting the same thing on iOS also.

I've tried this is two different Expo 41 projects with the same results. The only difference is that I am using React native hold menu v0.1.0.

My project did work with rn hold menu 0.0.8 BUT with Expo 40 which had the RC for Reanimated. I'm wondering if this is an issue with reanimated v2.1.0?

markmccoid avatar May 27 '21 23:05 markmccoid

Hi guys, this was an important issue that SW Mansion team worked on it and solved in Reanimated v2.1.0 actually. But some how it still does not work on Expo projects. I told them and not sure the team will work on it.

For now, you should use React Native Hold Menu v0.1.0 and it will work on bare RN workflow. Expo will sill throw this error and this issue is about Reanimated.

So as I understood, both of your examples are in Expo project. I already know this issue. If there is some other issue let me know.

enesozturk avatar May 29 '21 21:05 enesozturk

Thanks for the reply. Yes, I'm using Expo managed workflow (SDK 41). I'm not sure I'm ready to go to the bare workflow yet, but I really like this library and find it very useful!

Thanks

markmccoid avatar Jun 02 '21 16:06 markmccoid

Thanks @markmccoid. I was so excited and still excited about this repo but unfortunately it needs some time and improvements/fixes on Reanimated, Expo and itself to be used in production. Will continue to work on it 🔥

enesozturk avatar Jun 02 '21 18:06 enesozturk

I found Expo 41 ships reanimated v2.0.1 native modules, but v2.1.0 on JS side expo/expo@d783eeb

Not sure why, maybe because the reanimated release was a little late during expo 41 release, so they don't took the risk to ship with it. Anyway I don't think there will be a solution until expo 42 in managed workflow…

colinux avatar Jun 04 '21 13:06 colinux

Is this issue still present with Expo SDK 43?

hirbod avatar Oct 30 '21 10:10 hirbod

having the same issue with react-native-reanimated 3.x

pep108 avatar Jun 13 '23 20:06 pep108