Uniwind re-exports PushNotificationIOS from react-native in src/components/index.ts:
get PushNotificationIOS() {
return require('react-native').PushNotificationIOS
},
React Native removed PushNotificationIOS from core a while back (deprecated since 0.60). This doesn't crash in dev because Metro lazy-evaluates the getter. In release builds though, Metro walks all module getters eagerly, which pulls in the dead import:
uniwind/src/components/index.ts:200
→ react-native/index.js:295
→ react-native/Libraries/PushNotificationIOS/PushNotificationIOS.js:67
→ new NativeEventEmitter() with a null argument → boom
Errors on launch:
ERROR [Invariant Violation: \`new NativeEventEmitter()\` requires a non-null argument.]
ERROR [Error: Uncaught (in promise) TypeError: Cannot read property 'default' of undefined]
App crashes instantly on any release/production build. Took us a while to track down because everything works fine in dev mode.
We're patching it with a postinstall script that swaps the getter to `return null`. Works, but not ideal.
The fix should be straightforward: return null from that getter (or drop it). Worth checking the other re-exports in that file too. `Clipboard` was also deprecated from RN core and could hit the same thing.
Environment:
- uniwind: 1.6.3
- react-native: 0.83.6 (Expo SDK 55)
- expo: 55.0.17
- Platform: iOS release build
Uniwind re-exports
PushNotificationIOSfromreact-nativeinsrc/components/index.ts:React Native removed
PushNotificationIOSfrom core a while back (deprecated since 0.60). This doesn't crash in dev because Metro lazy-evaluates the getter. In release builds though, Metro walks all module getters eagerly, which pulls in the dead import:Errors on launch:
App crashes instantly on any release/production build. Took us a while to track down because everything works fine in dev mode.
We're patching it with a postinstall script that swaps the getter to `return null`. Works, but not ideal.
The fix should be straightforward: return null from that getter (or drop it). Worth checking the other re-exports in that file too. `Clipboard` was also deprecated from RN core and could hit the same thing.
Environment: