Comments (6)
Am also experiencing this crash after upgrading react-native-reanimated
to v3. Looks like there is some sort of conflict between reanimated and the onSuccess
/onError
events that this library emits.
The way the react native docs state to emit events differs from how this library is doing it and updating this library's code to the recommended approach happens to also bypass the problem (by using RCTEventEmitter
instead of EventDispatcher
).
Here is an example of a patch using patch-package
that can be used until myself or someone else raises a PR.
diff --git a/node_modules/react-native-streetview/android/src/main/java/co/il/nester/android/react/streetview/NSTStreetView.java b/node_modules/react-native-streetview/android/src/main/java/co/il/nester/android/react/streetview/NSTStreetView.java
index 369672c..2f0610a 100644
--- a/node_modules/react-native-streetview/android/src/main/java/co/il/nester/android/react/streetview/NSTStreetView.java
+++ b/node_modules/react-native-streetview/android/src/main/java/co/il/nester/android/react/streetview/NSTStreetView.java
@@ -13,8 +13,7 @@ import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.bridge.Arguments;
-import com.facebook.react.uimanager.UIManagerModule;
-import com.facebook.react.uimanager.events.EventDispatcher;
+import com.facebook.react.uimanager.events.RCTEventEmitter;
import com.google.android.gms.maps.OnStreetViewPanoramaReadyCallback;
import com.google.android.gms.maps.StreetViewPanorama;
import com.google.android.gms.maps.model.LatLng;
@@ -70,16 +69,15 @@ public class NSTStreetView extends StreetViewPanoramaView implements OnStreetVie
this.panorama.setPanningGesturesEnabled(allGesturesEnabled);
this.panorama.setStreetNamesEnabled(!streetNamesHidden);
- final EventDispatcher eventDispatcher = ((ReactContext) getContext())
- .getNativeModule(UIManagerModule.class).getEventDispatcher();
+ Context context = getContext();
+ ReactContext reactContext = (ReactContext)context;
this.panorama.setOnStreetViewPanoramaCameraChangeListener(new StreetViewPanorama.OnStreetViewPanoramaCameraChangeListener() {
@Override
public void onStreetViewPanoramaCameraChange(StreetViewPanoramaCamera streetViewPanoramaCamera) {
if (!(streetViewPanoramaCamera.bearing >= 0 ) && coordinate != null) {
- eventDispatcher.dispatchEvent(
- new NSTStreetViewEvent(getId(), NSTStreetViewEvent.ON_ERROR)
- );
+ reactContext.getJSModule(RCTEventEmitter.class)
+ .receiveEvent(getId(), "onError", null);
}
}
});
@@ -91,13 +89,11 @@ public class NSTStreetView extends StreetViewPanoramaView implements OnStreetVie
WritableMap map = Arguments.createMap();
map.putDouble("latitude", streetViewPanoramaLocation.position.latitude);
map.putDouble("longitude", streetViewPanoramaLocation.position.longitude);
- eventDispatcher.dispatchEvent(
- new NSTStreetViewEvent(getId(), NSTStreetViewEvent.ON_SUCCESS, map)
- );
+ reactContext.getJSModule(RCTEventEmitter.class)
+ .receiveEvent(getId(), "onSuccess", map);
} else {
- eventDispatcher.dispatchEvent(
- new NSTStreetViewEvent(getId(), NSTStreetViewEvent.ON_ERROR)
- );
+ reactContext.getJSModule(RCTEventEmitter.class)
+ .receiveEvent(getId(), "onError", null);
}
}
});
diff --git a/node_modules/react-native-streetview/android/src/main/java/co/il/nester/android/react/streetview/NSTStreetViewManager.java b/node_modules/react-native-streetview/android/src/main/java/co/il/nester/android/react/streetview/NSTStreetViewManager.java
index 595b5c1..75a87b6 100644
--- a/node_modules/react-native-streetview/android/src/main/java/co/il/nester/android/react/streetview/NSTStreetViewManager.java
+++ b/node_modules/react-native-streetview/android/src/main/java/co/il/nester/android/react/streetview/NSTStreetViewManager.java
@@ -55,9 +55,10 @@ public class NSTStreetViewManager extends SimpleViewManager<NSTStreetView> {
@Override
public @Nullable
Map getExportedCustomDirectEventTypeConstants() {
- return MapBuilder.of(
- NSTStreetViewEvent.eventNameForType(NSTStreetViewEvent.ON_ERROR), MapBuilder.of("registrationName", NSTStreetViewEvent.eventNameForType(NSTStreetViewEvent.ON_ERROR)),
- NSTStreetViewEvent.eventNameForType(NSTStreetViewEvent.ON_SUCCESS), MapBuilder.of("registrationName", NSTStreetViewEvent.eventNameForType(NSTStreetViewEvent.ON_SUCCESS))
- );
+ return MapBuilder.builder()
+ .put("onSuccess",
+ MapBuilder.of("registrationName", "onSuccess"))
+ .put("onError", MapBuilder.of("registrationName", "onError"))
+ .build();
}
}
from react-native-streetview.
Same issue here. I'm debugging it at the moment. I will update when I found the root cause.
from react-native-streetview.
These are the log for the crash.
java_vm_ext.cc:577] JNI DETECTED ERROR IN APPLICATION: can't call java.lang.String java.lang.Object.toString() on null object
java_vm_ext.cc:577] in call to CallObjectMethodV
java_vm_ext.cc:577] from void com.swmansion.reanimated.nativeProxy.EventHandler.receiveEvent(java.lang.String, com.facebook.react.bridge.WritableMap)
Seems to be related to re animated. The last changes I did make before the crash happen is to update the Re-Animated Package from v2 to v3. Probably worth testing on your implementation. @ccriptdev7
from react-native-streetview.
Downgraded my react-native-reanimated from v3 to v2. That solved the issue for now.
from react-native-streetview.
Yes exactly. I downgraded my react-native-reanimated to v2 which resolved the issue. However, downgrading react-native-reanimated caused problems in my iOS apps. I hope there's a path for this.
from react-native-streetview.
fixed in v0.2.4
thanks for your work @mwh1r
from react-native-streetview.
Related Issues (20)
- How can I detect if Google StreetView available for a location (lat, lng)? HOT 3
- Radius property not working HOT 1
- Black screen on ios HOT 2
- Callback mismatch between iOS and Android HOT 1
- fatal error: module 'GoogleMaps' not found HOT 3
- How to get the updated latitude and longitude when moving, is there any subscribe event? HOT 4
- React/RCTViewManager.h not found HOT 1
- Take only google material
- requireNativeComponent NSTView not found in the UIModule HOT 2
- How to disable indoor viewing
- Marker on StreetView
- Any way to access the pov user has navigated to?
- requireNativeComponent: "NSTStreetView" was not found in the UIManager. HOT 8
- Invariant Violation: requireNativeComponent: "NSTStreetView" was not found in the UIManager. HOT 3
- Custom marker support
- any chance to get events on street navigation?
- Ios pov support
- In order to compile Java 9+ source, please set compileSdkVersion to 30 or above HOT 3
- No variants found for ':react-native-streetview'. Check build files to ensure at least one variant exists HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-streetview.