dominicstop / react-native-ios-context-menu

A react-native component to use context menu's (UIMenu) on iOS 13/14+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

mozzius opened this issue · comments

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

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?

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 :(

commented

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?

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

Same, I think removing reanimated fixed it for me

commented

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

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.

Reopening as it's happening to us on RN 0.75

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?

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.

Are people still getting this error?

commented

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",

Are people still getting this error?

I believe this issue is still occurring on RN 0.73.2

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

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.

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>