dominicstop / react-native-ios-context-menu

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

Crash when closing ContextMenuView: [__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1] #70

Closed mozzius closed 10 months ago

mozzius commented 1 year ago

Trying to upgrade to Expo 49, and now when trying to close my ContextMenuViews, the app crashes.

Screenshot 2023-06-29 at 17 03 33
czamp commented 1 year ago

I'm getting the same error after upgrading my project to Expo 49, as well, and it's not present when I remove references to this library.

Any luck with a workaround?

mozzius commented 1 year ago

bizarrely, it stopped happening to me, and I'm not sure when (since I stopped trying to use them while I thought it would crash the app). sorry I can't be more help than that :(

TomWq commented 1 year ago

I'm getting the same error after upgrading my project to Expo 49, as well, and it's not present when I remove references to this library.

Any luck with a workaround?

peterferguson commented 11 months ago

Getting this as well but it only happens if the component in renderAuxiliaryPreview uses react-native-reanimated

nandorojo commented 11 months ago

Same, I think removing reanimated fixed it for me

fukemy commented 11 months ago

I got this error when upgrade to react native 0.71.3, only show this error in Debug mode, Release mode run normally, after upgrade to rn 0.72.5, this problem gone

nandorojo commented 11 months ago

Upgrading would make sense as the fix, as I also have not seen this error on RN 0.72.5. I'm going to close this issue, but if someone can confirm it still happens on RN 0.72.5 after removing reanimated from the auxiliary, we can reopen.

nandorojo commented 11 months ago

Reopening as it's happening to us on RN 0.75

nandorojo commented 11 months ago

I believe this was caused by clicking an item inside of an auxiliary view (specifically a chat reaction inside of a FlashList). Any potential work arounds? Would a delay before calling dismissMenu help @dominicstop?

nandorojo commented 11 months ago

This is kind of weird but, quitting the Expo dev client entirely and reopening it seems to have fixed it. But refreshing Metro did not. So I'm wondering if there is a memory issue related...I'll try the new v2 and see how that goes.

nandorojo commented 10 months ago

Are people still getting this error?

fukemy commented 10 months ago

No I did not get this error, you can check my package:

    "react": "^18.2.0",
    "react-native": "^0.72.5",
    "react-native-reanimated": "^3.5.4",
    "@react-navigation/native": "^6.1.8",
    "@react-navigation/native-stack": "^6.9.12",
    "@react-navigation/stack": "^6.3.18",
    "react-native-ios-context-menu": "^1.15.1",
    "react-native-screens": "^3.20.0",
valentinchelle commented 8 months ago

Are people still getting this error?

I believe this issue is still occurring on RN 0.73.2

focux commented 7 months ago

Yes, I'm on 0.73.1 and still getting this error.

focux commented 4 months ago

FYI, what fixed this for me was to wrap the children of the ContextMenuView inside a View. I was using FlashList and looks like the recycling was causing to remove and add the children of the context menu.

whalemare commented 3 months ago

Has same issue on 1.6.2 (non-expo)

    "react-native-ios-context-menu": "1.6.2",
    "react-native": "0.74.1",
      <View style={{ flexDirection: 'row', gap: 8 }}>
        {item.images.map(image => {
          return (
            <ContextMenuView
              key={image.id}
              previewConfig={{
                previewType: 'CUSTOM',
                previewSize: 'INHERIT',
              }}
              renderPreview={() => {
                return (
                  <View>
                    <ImageView style={{ width: 400, height: 400 }} url={image.original} />
                  </View>
                )
              }}
            >
              <View>
                <ImageView style={{ width: 100, height: 100 }} url={image.thumbnail} />
              </View>
            </ContextMenuView>
          )
        })}
      </View>