I’ve recently updated to Expo v46, and it’s working smoothly on Expo Go. However, the APK and iOS simulator build of the same app crashes at the splash screen.
I’ve done an adb logcat
and found this error regarding ViewPropTypes
:
ReactNativeJS: Invariant Violation: ViewPropTypes
has been removed from React Native. Migrate to
ViewPropTypes exported from 'deprecated-react-native-prop-types'.
- Why doesn’t this error appear on Expo Go?
- I’ve searched through all my code and node_modules and have replaced all usages of ViewPropTypes that import from
react-native
. I did not touch those inreact-native
or those that import from paths like'react-native/Libraries/Components/View/ViewPropTypes';
- Since I still get the error even though I’ve fixed the usages of it, I tried to patch React Native using this: Invariant Violation: ViewPropTypes has been removed from React Native. · Issue #33734 · facebook/react-native · GitHub, but I end up with a prebuild error that does not happen without the patch:
[stderr] The android project is malformed, project files will be cleared and reinitialized.
- Clearing android
✔ Cleared android code
- Creating native project directories (./ios and ./android) and updating .gitignore
✔ Created native project | gitignore skipped
- Adding Metro bundler config
› Metro skipped: Project metro.config.js does not match prebuild template.
› Ensure the project uses @expo/metro-config.
Learn more: https://docs.expo.dev/guides/customizing-metro
- Updating your package.json scripts, dependencies, and main file
✔ Updated package.json and added index.js entry point for iOS and Android
- Config syncing
[stderr] Using node to generate images. This is much slower than using native packages.
[stderr] › Optionally you can stop the process and try again after successfully running `npm install -g sharp-cli`.
- Config syncing
[stderr] » android: sentry-expo: Could not find react.gradle script in android/app/build.gradle. Please open a bug report at https://github.com/expo/sentry-expo.
- Config syncing
✔ Config synced
Running "npm install" in the root dir of your repository
> mycompany.myappname@4.50.1 postinstall
> ./npm-postinstall.sh
patching file node_modules/react-native/index.js
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file node_modules/react-native/index.js.rej
[stderr] npm
[stderr] ERR! code 1
[stderr] npm
[stderr] ERR! path /home/expo/workingdir/build
[stderr] npm ERR!
[stderr] command failed
[stderr] npm ERR! command sh -c ./npm-postinstall.sh
[stderr] npm ERR! A complete log of this run can be found in:
[stderr] npm ERR! /home/expo/.npm/_logs/2022-08-24T11_10_00_715Z-debug.log
npm exited with non-zero code: 1
npm-postinstall.sh is just 1 line:
patch -p1 < RN-deprecated-proptypes.patch -N
Are we not allowed to patch React Native? How would I get around this ViewPropTypes issue?