react-native-root-toast: Crash reports from production

First of all, thanks for making and supporting this library 😃

We’re using it in our app (V 3.2.1), and we’re seeing quite a lot of errors from production (from the Google play console). Here’s a typical stack trace:

com.facebook.react.common.JavascriptException: TypeError: undefined is not a function
This error is located at:
in ToastContainer
in _default
in _default
in Root
in RootSiblingParent
in Root
in UserProvider
in ThemeProvider
in _default
in RCTView
in Unknown
in ChildrenWrapper
in _default
in Root
in RCTView
in Unknown
in AppContainer, js engine: hermes, stack:
anonymous@1:644553
commitUnmount@1:93662
unmountHostComponents@1:95576
commitMutationEffects@1:96794
commitRootImpl@1:103897
commitRoot@1:103518
performSyncWorkOnRoot@1:100589
flushSyncCallbacks@1:68909
scheduleUpdateOnFiber@1:98451
updateContainer@1:108227
unmountComponentAtNode@1:108455
anonymous@1:117847
unmountApplicationComponentAtRootTag@1:439181
__callFunction@1:128697
anonymous@1:127320
__guard@1:128264
callFunctionReturnFlushedQueue@1:127278
at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java
  at java.lang.reflect.Method.invoke (Native Method)
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:188)
  at com.facebook.react.bridge.queue.NativeRunnable.run (Native Method)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
  at android.os.Looper.loop (Looper.java:246)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:226)
  at java.lang.Thread.run (Thread.java:923)

We’re totally unable to recreate this internally. I think it’s happening from our app when we have code that responds to a notification being received in the foreground - in that case it uses this lib to show a message to the user. The toast is wrapped in this helper:

const ToastInfo = (message, options) => {
  try {
    Toast.show(message, {
      ...baseOptions,
      position: Platform.OS === 'android' ? 70 : 80,
      backgroundColor: AppColors.blue80,
      ...options,
    });
  } catch {
    // Something went wrong with Toast..
    // Logging code here.
  }
};

So the addition of the try/catch doesn’t catch anything, I’m a bit stumped about where to look next…

Any ideas?

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 2
  • Comments: 16

Most upvoted comments

Is it the same as https://github.com/magicismight/react-native-root-toast/issues/146 ?

Can you guys try install the master version which includes a fix to the problem above

npm install https://github.com/magicismight/react-native-root-toast

I have the error too

com.facebook.react.common.JavascriptException: TypeError: undefined is not a function
This error is located at:
in ToastContainer
in _default
in _default
in Root
in RootSiblingParent
in App
in RCTView
in Unknown
in ChildrenWrapper
in _default
in Root
in RCTView
in Unknown
in AppContainer, js engine: hermes, stack:
anonymous@1:702238
commitUnmount@1:104651
unmountHostComponents@1:106661
commitMutationEffects@1:107973
commitRootImpl@1:115621
commitRoot@1:115206
performSyncWorkOnRoot@1:112167
flushSyncCallbacks@1:79676
scheduleUpdateOnFiber@1:109696
updateContainer@1:120009
unmountComponentAtNode@1:120232
anonymous@1:129857
unmountApplicationComponentAtRootTag@1:446505
__callFunction@1:56173
anonymous@1:54662
__guard@1:55619
callFunctionReturnFlushedQueue@1:54620
at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java
  at java.lang.reflect.Method.invoke (Native Method)
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:188)
  at com.facebook.react.bridge.queue.NativeRunnable.run (Native Method)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
  at android.os.Looper.loop (Looper.java:246)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:226)
  at java.lang.Thread.run (Thread.java:923)