Description
Lifting #84 into a new issue.
Problem
New Architecture isn't working with this library.
Context
React Native 0.74 is coming with bridgeless mode and improvements for the new architecture. It appears that Expo is finally adopting it and they have a plan to test libraries for it.
How to test it
Here brent explains how to test New Architecture support with an Expo Module (it's easy): https://x.com/notbrent/status/1774931733194088465?s=20
TLDR: install expo-build-properties
into the app you're testing, and add it to your app.json, set newArchEnabled: true
.
Show code
{
"expo": {
"name": "try-zeego",
"slug": "try-zeego",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.example.with-new-arch"
},
"android": {
"package": "com.example.withnewarch"
},
"plugins": [
[
"expo-build-properties",
{
"ios": {
"newArchEnabled": true
},
"android": {
"newArchEnabled": true
}
}
]
]
}
}
Here is a reproduction showing that this library does not currently work with the new architecture.
There's no crash, but the menu doesn't open.
Solution
Fabric deprecates findNodeHandle()
, and it looks like react-native-ios-context-menu
uses that function.
I think the solution would be to remove findNodeHandle
in favor of the component's ref.
I'm not sure if other changes would be needed, but I'd assume that would fix it.
This also removes the bridge, so I think self.bridge
would not be an option to use either.