Is there an Android equivalent of the RCTJavaScriptDidLoadNotification event in react-native?

Viewed 204

When writing native iOS modules for react-native it's possible to subscribe to the RCTJavaScriptDidLoadNotification notification. This allows you to perform some additional native setup once the JS bundle has been loaded into the environment.

As far as I can see there's nothing equivalent when writing Android modules (unless it has a different name). There's initialize which you can override from ReactContextBaseJavaModule but this seems to be called before the JS bundle has been loaded.

Is there an Android equivalent of the RCTJavaScriptDidLoadNotification notification/event?

1 Answers

You should try onReactContextInitialized

@Override
public void onReactContextInitialized(ReactContext context) {
    Log.d(TAG, "Here's your valid ReactContext");
}
Related