Reproduction: https://github.com/antonijap/uniwind-pushnotification-repro
Clone, install, run a release build on iOS:
git clone https://github.com/antonijap/uniwind-pushnotification-repro
cd uniwind-pushnotification-repro
npm install
npx expo run:ios --configuration Release
App crashes on launch. Works fine in dev mode.
src/components/index.ts line ~199 re-exports PushNotificationIOS from react-native:
get PushNotificationIOS() {
return require('react-native').PushNotificationIOS
},
RN removed this from core (deprecated since 0.60). Dev mode does not crash because Metro lazy-evaluates the getter. Release builds evaluate all getters eagerly, which triggers:
uniwind/src/components/index.ts:200
-> react-native/Libraries/PushNotificationIOS/PushNotificationIOS.js:67
-> new NativeEventEmitter() with null argument -> crash
Errors:
ERROR [Invariant Violation: new NativeEventEmitter() requires a non-null argument.]
ERROR [TypeError: Cannot read property 'default' of undefined]
We are patching via postinstall (return null instead of the require). Clipboard in the same file is also deprecated and could hit the same thing.
- uniwind 1.6.3
- react-native 0.83.6
- Expo SDK 55
- iOS release build
Reproduction: https://github.com/antonijap/uniwind-pushnotification-repro
Clone, install, run a release build on iOS:
App crashes on launch. Works fine in dev mode.
src/components/index.tsline ~199 re-exportsPushNotificationIOSfromreact-native:RN removed this from core (deprecated since 0.60). Dev mode does not crash because Metro lazy-evaluates the getter. Release builds evaluate all getters eagerly, which triggers:
Errors:
We are patching via postinstall (
return nullinstead of the require).Clipboardin the same file is also deprecated and could hit the same thing.