Skip to content

Commit bf1737c

Browse files
committed
Trying to fix the problem when sendEvent method was fired before React was fully set up, as suggested in OneSignal#906
1 parent 41e32ae commit bf1737c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

android/src/main/java/com/geektime/rnonesignalandroid/RNOneSignal.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ private void removeHandlers() {
135135
}
136136

137137
private void sendEvent(String eventName, Object params) {
138+
if(!mReactContext.hasActiveCatalystInstance()) {
139+
return;
140+
}
141+
138142
mReactContext
139143
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
140144
.emit(eventName, params);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-onesignal",
3-
"version": "4.3.0",
3+
"version": "4.3.1",
44
"description": "React Native OneSignal SDK",
55
"main": "src/index",
66
"typings": "src/index.d.ts",

0 commit comments

Comments
 (0)