🤝 Merge pull request #56 from Instabug/hotfix/add_send_event_method

🐛 Fix a bug where the sendEvent method was not added
This commit is contained in:
Hossam Hassan 2017-08-10 12:30:35 +03:00 committed by GitHub
commit 65ae5a977e
2 changed files with 12 additions and 2 deletions

View File

@ -4,7 +4,9 @@ import android.app.Application;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.Nullable;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
@ -16,6 +18,7 @@ import com.facebook.react.bridge.WritableMap;
import com.facebook.react.bridge.WritableNativeMap;
import com.facebook.react.bridge.Callback;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.instabug.library.Instabug;
import com.instabug.library.internal.module.InstabugLocale;
import com.instabug.library.invocation.InstabugInvocationEvent;
@ -1013,7 +1016,6 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
}
}
/**
* Sets the runnable that gets executed just before showing any valid survey<br/>
* WARNING: This runs on your application's main UI thread. Please do not include
@ -1237,6 +1239,14 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
}
}
private void sendEvent(ReactApplicationContext reactContext,
String eventName,
@Nullable WritableMap params) {
reactContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);
}
@Override
public Map<String, Object> getConstants() {
final Map<String, Object> constants = new HashMap<>();

View File

@ -1,4 +1,4 @@
import {NativeModules, NativeAppEventEmitter, Platform} from "react-native";
import {NativeModules, NativeAppEventEmitter, DeviceEventEmitter, Platform} from "react-native";
let {Instabug} = NativeModules;
/**