Comments (16)
@mfazekas Thanks for pointing it out. Yes it was caused by the same problem, just added a commit to the PR that fixes the problem for these map related events.
from maps.
Does it only happen when clustering is enabled?
from maps.
I've also noticed that the onPress in UserLocation calls twice with each press.
from maps.
It is being called twice as for me on Android only for MapView onPress. I am on 7.0.0-rc-2
from maps.
We came under the same problem. I pinned it down to duplicate events being dispatched once by the ShapeSource and once by the UIManager.
This patch fixes it but I've haven't had time yet to check if it creates any other side effects.
diff --git a/node_modules/@react-native-mapbox/maps/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/AbstractEventEmitter.java b/node_modules/@react-native-mapbox/maps/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/AbstractEventEmitter.java
index 7fa9007..d8a093c 100644
--- a/node_modules/@react-native-mapbox/maps/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/AbstractEventEmitter.java
+++ b/node_modules/@react-native-mapbox/maps/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/AbstractEventEmitter.java
@@ -42,12 +42,13 @@ abstract public class AbstractEventEmitter<T extends ViewGroup> extends ViewGrou
return;
}
- mRateLimitedEvents.put(eventCacheKey, System.currentTimeMillis());
- mEventDispatcher.dispatchEvent(new AbstractEvent(event.getID(), event.getKey(), event.toJSON()));
-
RCTEventEmitter emitter = EventEmitter.getViewEmitter(mRCTAppContext);
+ mRateLimitedEvents.put(eventCacheKey, System.currentTimeMillis());
+ // try to get view dispatcher, otherwise use the UImanager emitter
if (emitter != null) {
emitter.receiveEvent(event.getID(), event.getKey(), event.toJSON());
+ } else {
+ mEventDispatcher.dispatchEvent(new AbstractEvent(event.getID(), event.getKey(), event.toJSON()));
}
}
from maps.
Looks like to me it's a result of merge error:
One change mEventDispatcher.dispatchEvent(
was nitaliano/react-native-mapbox-gl#1508
react-native-mapbox-gl/maps@7458dd1#diff-67b563fd89b6669ee1bc084451e62e57R41
other was from expression changes:
nitaliano/react-native-mapbox-gl@fc8901f#diff-67b563fd89b6669ee1bc084451e62e57R42
I guess the first change should win, so we should keep mEventDispatcher.dispatchEvent(new AbstractEvent(event.getID(), event.getKey(), event.toJSON()));
and remove emitter
related lines.
from maps.
Yeah that looks like what's happened. I'll get it into a PR later today.
edit: actually after some testing it looks like the emitter
is still needed for certain events
from maps.
from maps.
edit: actually after some testing it looks like the
emitter
is still needed for certain events
I've implemented the fix in #137. Let me know if you're seeing double events/missing events now.
from maps.
All - Thanks for working a solution to this one and actively maintaining this repo! We are holding off on releasing our Android app until we work this fix in. When might we expect the new release to be tagged and up on npm?
from maps.
Apologies for not submitting a fix, after removing the emitter.receiveEvent
we noticed some callbacks on the Map
component were no longer firing. One of which was onDidFinishLoadingStyle
. Has anyone else noticed the same?
from maps.
@makirby is this in production env, or only in development mode after a reload of the JS side?
from maps.
I could still get it to happen in production, albeit more intermittently.
I suspected it was something to do with throttling so did a rebuild with the didStartRenderingFrame
& didFinishRenderingFrame
listeners removed, with those removed the onDidFinishLoadingStyle
events would then fire every time, in dev and production.
from maps.
@makirby might or might not related to #177
from maps.
@mfazekas yeah that looks like the cause
from maps.
Hmmm I'm trying to get a ShapeSource
's onPress
to work, but it's not running the function at all! Any advice?
Some important packages I'm using:
"@react-native-mapbox-gl/maps": "^7.0.4",
"react": "^16.9.0",
"react-native": "^0.60.5",
Platfrom: [Android]
SDK Version [28]
I've been using very similar code to this example but including onPress={(e) => console.log("shapesource press", e)}
prop in the ShapeSource
component.
I am not getting any errors or anything, and no console log messages either. Is anyone else running into a similar issue with the above packages?
from maps.
Related Issues (20)
- [Bug]: styleUrl and custom font: Mapbox error MapLoad error Failed to load glyphs HOT 3
- [Bug]: layer filter prop not working on iOS HOT 7
- I have a list of store data in a bottom flatlist, and when I scroll through the list, the map is supposed to animate and display a custom marker corresponding to the selected store. However, there are instances where the marker does not show, and at times, the map itself does not load. This intermittent issue requires further investigation to determine the root cause and implement a resolution. HOT 1
- [Bug]: Android PointAnnotation callbacks onDrag, onDragStart, and onDragEnd do not fire HOT 3
- iOS Pod error even after following setup HOT 3
- [Bug]: ERROR Mapbox error setWellKnownTileServer is deprecated and will be removed {"level": "error", "message": "setWellKnownTileServer is deprecated and will be removed", "tag": "RNMBXModule"} HOT 1
- [Bug]: ERROR Mapbox error setWellKnownTileServer is deprecated and will be removed {"level": "error", "message": "setWellKnownTileServer is deprecated and will be removed", "tag": "RNMBXModule"} HOT 2
- [Bug]: Broken Camera centerCoordinate HOT 1
- [Bug]: UserLocation & LineLayer disappearing when adding RasterLayer
- [Bug]: Ornament position differs on Android and iOS
- Could not find com.mapbox.maps:android:10.16.4. HOT 6
- [Bug]: PointAnnotation draggable props not working on ios
- [Bug]: Crash on Android with dynamic shape source (Ios works fine), Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR) HOT 8
- > Task :rnmapbox_maps:compileReleaseKotlin FAILED when building apk HOT 2
- [Bug]: Camera.zoomTo not working HOT 5
- [Bug]: `LocationPuck` bearing not visible on Android HOT 1
- [Upstream Bug]: Camera centers incorrectly around bounds with padding HOT 3
- Expo Prebuild Secret Key HOT 4
- Android: When user pitches the map (two finger swipe gesture), isGestureActive becomes false when pitch starts to change
- [Bug]: RNMBXModels.models.getter not implemented (Expo Project) HOT 6
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 maps.