Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React: Calling JS function after bridge has been destroyed --- How to find which function

I'm working on an update for our app. I've added a HeadlessTask and I've started seeing this warning in the console:

React: Calling JS function after bridge has been destroyed

How can I get the name of the function being executed?

like image 736
jcity Avatar asked Aug 31 '17 02:08

jcity


Video Answer


1 Answers

From the error message I assume you're in java (react-native Android):

When you reload on react-native, what happens behind the scenes is that the react context is getting destroyed, and a new one is being created.

That error get's thrown whenever a react-native Native Module is trying to do work, by using the old react context (the one that was valid before the reload).

The last time I saw that error it also included an explanation as to which module tried to do work by using the old context. Typically it's the RCTDeviceEventEmitter module trying to send a message to javascript.

You'll have to open logcat on Android studio and read the full error message.

p.s: If you're using react-native-navigation in your project, (after you discover which module is the trouble maker by using the logcat), make sure to search on their issues as they are heavily using the native side of react-native android, and I've seen lot's of similar issues so far.

like image 170
SudoPlz Avatar answered Sep 30 '22 20:09

SudoPlz