Skip to content

Commit

Permalink
fix: Check hasActiveCatalystInstance when trying to sendEvent (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
JK0N authored Feb 14, 2020
1 parent 9407afd commit dd7c7c6
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ public void onReceive(Context context, Intent intent) {
}

private void sendEvent(String eventName, @Nullable WritableMap params) {
mReactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);
if (mReactContext.hasActiveCatalystInstance()) {
mReactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);
}
}

private void registerReceiver(Context reactContext, String filter, BroadcastReceiver receiver) {
Expand Down

0 comments on commit dd7c7c6

Please sign in to comment.