Home > OS >  react-native-in-app-notification ERROR TypeError: undefined is not an object (evaluating '_reac
react-native-in-app-notification ERROR TypeError: undefined is not an object (evaluating '_reac

Time:12-06

I am using react native expo's latest SDK. While using the react-native-in-app-notification package I am getting the following error,

 ERROR  TypeError: undefined is not an object (evaluating '_reactNative.Image.propTypes.source')
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.unmountApplicationComponentAtRootTag(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an e ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered 
callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerform        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

Please help me...

CodePudding user response:

proptTypes is removed from react-native, which results unmaintained packages having these issues. You can either fork that repo then apply changes & use your forked repo or follow below method to patch-package with fixes in package.

  1. Open node_modules/react-native-in-app-notification
  2. Apply changes to corresponding files mentioned in this PR : Resolve type errors
  3. From root of your project run npm i patch-package (patch-package)
  4. Run npx patch-package react-native-in-app-notification (This will create a patch file with changes in node_modules file of your package)
  5. Add "postinstall": "patch-package" under scripts in package.json to automatically run patch-package and apply changes after npm install
  • Related