Open EliotAndres opened 6 years ago
Hi, just FYI I am also seeing this issue.
Hi,
This issue can be avoided by adding this to 'node_modules/react-native-beacons-manager/com/mackentoch/beaconsandroid/BeaconsAndroidModule.java':
if (reactContext.hasActiveCatalystInstance()) { <---- add this
reactContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);
} <---- and this
Hi, Could you provide me with an example of how you solved this problem?
Hi @brayanAP, I did what @mojotti wrote and it works.
Go to: node_modules/react-native-beacons-manager/android/src/main/java/com/mackentoch/beaconsandroid/BeaconsAndroidModule.java'
Then change this method from this (line 404 for me):
private void sendEvent(ReactContext reactContext, String eventName, @Nullable WritableMap params) {
reactContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);
}
to this:
private void sendEvent(ReactContext reactContext, String eventName, @Nullable WritableMap params) {
if (reactContext.hasActiveCatalystInstance()) {
reactContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);
}
}
Restart app and it should work ;)
First of all, thank you for this plugin !
The current master branch (
5f0d44e850e607bd2629476bbf701beec3c4d093
) crashes on Android. I think it is because thebeaconServiceConnected
event is sent too early.A quick and dirty fix is to comment the line:
sendEvent(mReactContext, "beaconServiceConnected", null);
inBeaconsAndroidModule.java
Version
1.1.0
Platform
Android
OS version
android 6.0
Steps to reproduce