Skip to content

Commit ed5cdd5

Browse files
committed
Fix crash from new architecture upgrade
1 parent 8eba94d commit ed5cdd5

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

  • lib/android/app/src/main/java/com/wix/reactnativenotifications/fcm

lib/android/app/src/main/java/com/wix/reactnativenotifications/fcm/FcmToken.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import android.util.Log;
66

77
import com.facebook.react.ReactApplication;
8-
import com.facebook.react.ReactInstanceManager;
98
import com.facebook.react.bridge.ReactContext;
109
import com.google.firebase.messaging.FirebaseMessaging;
1110
import com.wix.reactnativenotifications.BuildConfig;
@@ -98,13 +97,9 @@ protected void refreshToken() {
9897
}
9998

10099
protected void sendTokenToJS() {
101-
final ReactInstanceManager instanceManager = ((ReactApplication) mAppContext).getReactNativeHost().getReactInstanceManager();
102-
ReactContext reactContext = instanceManager.getCurrentReactContext();
100+
ReactApplication reactApplication = (ReactApplication) mAppContext;
101+
ReactContext reactContext = reactApplication.getReactHost().getCurrentReactContext();
103102

104-
if (reactContext == null) {
105-
// If the react context is not available, try to get the current context from the react host (RN0.76).
106-
reactContext = ((ReactApplication) mAppContext).getReactHost().getCurrentReactContext();
107-
}
108103
// Note: Cannot assume react-context exists cause this is an async dispatched service.
109104
if (reactContext != null && reactContext.hasActiveReactInstance()) {
110105
Bundle tokenMap = new Bundle();

0 commit comments

Comments
 (0)