Synchronously fail when calling JS too early
Differential Revision: D3453476 fbshipit-source-id: 3fbfda46b4cb7d31f554df6760c5146c412ff468
This commit is contained in:
parent
cc8cf8f0f2
commit
6128b7236f
|
@ -137,7 +137,12 @@ public class ReactTestHelper {
|
|||
return null;
|
||||
}
|
||||
}).get();
|
||||
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
instance.initialize();
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -191,6 +191,9 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
|||
FLog.w(ReactConstants.TAG, "Calling JS function after bridge has been destroyed.");
|
||||
return;
|
||||
}
|
||||
if (!mInitialized) {
|
||||
throw new RuntimeException("Attempt to call JS function before instance initialization.");
|
||||
}
|
||||
|
||||
callJSFunction(executorToken, module, method, arguments, tracingName);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue