Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,18 @@ protected void refreshToken() {

protected void sendTokenToJS() {
final ReactInstanceManager instanceManager = ((ReactApplication) mAppContext).getReactNativeHost().getReactInstanceManager();
final ReactContext reactContext = instanceManager.getCurrentReactContext();
ReactContext reactContext = instanceManager.getCurrentReactContext();

if (reactContext == null) {
// If the react context is not available, try to get the current context from the react host (RN0.76).
reactContext = ((ReactApplication) mAppContext).getReactHost().getCurrentReactContext();
}
// Note: Cannot assume react-context exists cause this is an async dispatched service.
if (reactContext != null && reactContext.hasActiveCatalystInstance()) {
if (reactContext != null && reactContext.hasActiveReactInstance()) {
Bundle tokenMap = new Bundle();
tokenMap.putString("deviceToken", sToken);
mJsIOHelper.sendEventToJS(TOKEN_RECEIVED_EVENT_NAME, tokenMap, reactContext);
}
}

}
Loading