Skip to content

Commit 65ae5a9

Browse files
🤝 Merge pull request #56 from Instabug/hotfix/add_send_event_method
🐛 Fix a bug where the sendEvent method was not added
2 parents b47e21f + 5c05f53 commit 65ae5a9

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
import android.net.Uri;
55
import android.os.Handler;
66
import android.os.Looper;
7+
import android.support.annotation.Nullable;
78

9+
import com.facebook.react.bridge.Arguments;
810
import com.facebook.react.bridge.ReactApplicationContext;
911
import com.facebook.react.bridge.ReactContextBaseJavaModule;
1012
import com.facebook.react.bridge.ReactMethod;
@@ -16,6 +18,7 @@
1618
import com.facebook.react.bridge.WritableNativeMap;
1719
import com.facebook.react.bridge.Callback;
1820

21+
import com.facebook.react.modules.core.DeviceEventManagerModule;
1922
import com.instabug.library.Instabug;
2023
import com.instabug.library.internal.module.InstabugLocale;
2124
import com.instabug.library.invocation.InstabugInvocationEvent;
@@ -1013,7 +1016,6 @@ public void setIntroMessageEnabled(boolean enabled) {
10131016
}
10141017
}
10151018

1016-
10171019
/**
10181020
* Sets the runnable that gets executed just before showing any valid survey<br/>
10191021
* WARNING: This runs on your application's main UI thread. Please do not include
@@ -1237,6 +1239,14 @@ private Locale getLocaleByKey(String instabugLocale) {
12371239
}
12381240
}
12391241

1242+
private void sendEvent(ReactApplicationContext reactContext,
1243+
String eventName,
1244+
@Nullable WritableMap params) {
1245+
reactContext
1246+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
1247+
.emit(eventName, params);
1248+
}
1249+
12401250
@Override
12411251
public Map<String, Object> getConstants() {
12421252
final Map<String, Object> constants = new HashMap<>();

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {NativeModules, NativeAppEventEmitter, Platform} from "react-native";
1+
import {NativeModules, NativeAppEventEmitter, DeviceEventEmitter, Platform} from "react-native";
22
let {Instabug} = NativeModules;
33

44
/**

0 commit comments

Comments
 (0)