| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
When the native module isn't linked (Expo Go, Jest, web bundles, a prebuild before pods are installed), NativeModules.IntercomEventEmitter is undefined and the module-scope constant reads in index.tsx (e.g. IntercomEventEmitter.UNREAD_COUNT_CHANGE_NOTIFICATION) throw at import time, crashing the app on boot. Fall back to an empty object so failure is deferred to actual API calls instead of the import.
| Back | FazBrowse Home | New Git URL |
Description
When the Intercom native module isn't available — Expo Go, Jest, a web bundle, or a prebuild before pods are installed — NativeModules.IntercomEventEmitter is undefined. Since src/index.tsx reads constants off it at module scope (IntercomEventEmitter.UNREAD_COUNT_CHANGE_NOTIFICATION, WINDOW_DID_SHOW_NOTIFICATION, …), merely importing the package throws:
and crashes the app at boot, before any Intercom API is called.
This PR falls back to an empty object (?? {}) for both IntercomModule and IntercomEventEmitter, deferring the failure from import time to the first actual API call — where callers can handle it. Behavior is completely unchanged whenever the native module exists.
We've been running this exact change as a local patch in our production React Native (Expo) app — it's what lets the package coexist with environments where the native side isn't present.
Changes
Verification
Notes