I was tasked with updating the React Native version of a monorepo application from 0.71.12 to 0.73.0. I used the React Native Upgrade Helper as per the documentation, but I’m stuck with an issue that I can’t seem to resolve.
The app compiles fine, but when I start Metro and run yarn android in another terminal, I get the following error:
- Invalid hook call warning
- Cannot read property 'useContext' of null
Here’s what I’ve already tried:
- Ensured no conflicting versions of react, react-native, or react-dom across the monorepo.
- Added a resolutions section in the root package.json.
- Verified that I’m not breaking any hook rules.
- Confirmed that the Android SDK is correctly set up.
- Made sure that I updated all the files according to the Upgrade Helper.
What’s weird is that everything works fine if I revert back to version 0.71.12. It seems completely tied to the version upgrade.
What could be causing this?