Skip to content
This repository was archived by the owner on Jul 28, 2022. It is now read-only.
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
6 changes: 6 additions & 0 deletions android/src/main/java/tech/bam/RNBatchPush/RNBatchModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.content.res.Resources;
import android.graphics.Typeface;
import android.location.Location;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down Expand Up @@ -141,6 +142,11 @@ public void optOutAndWipeData(Promise promise) {
private void sendEvent(ReactContext reactContext,
String eventName,
@Nullable WritableMap params) {

if (!reactContext.hasActiveCatalystInstance()) {
Log.d(NAME, "React context has no active catalyst instance. Aborting send event.");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we would store the event, and send it later once react gets an active catalyst instance
Otherwise you lose the event :/

return;
}
reactContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it crash here? If so there might be a bug in RN and we should open an issue on their repo

Expand Down