react-native-maps 1.21.0-alpha.67 → 1.21.0-alpha.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -20,7 +20,6 @@ import java.util.Map;
|
|
|
20
20
|
@ReactModule(name = CalloutManager.REACT_CLASS)
|
|
21
21
|
public class CalloutManager extends ViewGroupManager<MapCallout> implements RNMapsCalloutManagerInterface<MapCallout> {
|
|
22
22
|
|
|
23
|
-
|
|
24
23
|
public CalloutManager(ReactApplicationContext context){
|
|
25
24
|
super(context);
|
|
26
25
|
}
|
|
@@ -75,15 +74,4 @@ public class CalloutManager extends ViewGroupManager<MapCallout> implements RNMa
|
|
|
75
74
|
return new SizeReportingShadowNode();
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
@Override
|
|
79
|
-
public void updateExtraData(MapCallout view, Object extraData) {
|
|
80
|
-
// This method is called from the shadow node with the width/height of the rendered
|
|
81
|
-
// marker view.
|
|
82
|
-
//noinspection unchecked
|
|
83
|
-
Map<String, Float> data = (Map<String, Float>) extraData;
|
|
84
|
-
float width = data.get("width");
|
|
85
|
-
float height = data.get("height");
|
|
86
|
-
view.width = (int) width;
|
|
87
|
-
view.height = (int) height;
|
|
88
|
-
}
|
|
89
77
|
}
|
|
@@ -4,14 +4,6 @@ import android.content.Context;
|
|
|
4
4
|
|
|
5
5
|
import com.facebook.react.common.MapBuilder;
|
|
6
6
|
import com.facebook.react.views.view.ReactViewGroup;
|
|
7
|
-
import com.rnmaps.fabric.event.OnLongPressEvent;
|
|
8
|
-
import com.rnmaps.fabric.event.OnMarkerDeselectEvent;
|
|
9
|
-
import com.rnmaps.fabric.event.OnMarkerDragEndEvent;
|
|
10
|
-
import com.rnmaps.fabric.event.OnMarkerDragEvent;
|
|
11
|
-
import com.rnmaps.fabric.event.OnMarkerDragStartEvent;
|
|
12
|
-
import com.rnmaps.fabric.event.OnMarkerPressEvent;
|
|
13
|
-
import com.rnmaps.fabric.event.OnMarkerSelectEvent;
|
|
14
|
-
import com.rnmaps.fabric.event.OnPoiClickEvent;
|
|
15
7
|
import com.rnmaps.fabric.event.OnPressEvent;
|
|
16
8
|
|
|
17
9
|
import java.util.Map;
|
|
@@ -33,6 +25,13 @@ public class MapCallout extends ReactViewGroup {
|
|
|
33
25
|
return this.tooltip;
|
|
34
26
|
}
|
|
35
27
|
|
|
28
|
+
@Override
|
|
29
|
+
protected void onLayout(boolean changed,
|
|
30
|
+
int left, int top, int right, int bottom){
|
|
31
|
+
width = right - left;
|
|
32
|
+
height = bottom - top;
|
|
33
|
+
}
|
|
34
|
+
|
|
36
35
|
|
|
37
36
|
public static Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
|
|
38
37
|
MapBuilder.Builder<String, Object> builder = MapBuilder.builder();
|
|
@@ -253,16 +253,19 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
private <T extends Event> void dispatchEvent(WritableMap payload, EventCreator<T> creator) {
|
|
256
|
+
dispatchEvent(payload, creator, getId(), context);
|
|
257
|
+
}
|
|
258
|
+
public static <T extends Event> void dispatchEvent(WritableMap payload, EventCreator<T> creator, int viewId, ReactContext context){
|
|
256
259
|
// Cast context to ReactContext
|
|
257
260
|
ReactContext reactContext = context;
|
|
258
261
|
|
|
259
262
|
// Get the event dispatcher
|
|
260
|
-
EventDispatcher eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext,
|
|
263
|
+
EventDispatcher eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, viewId);
|
|
261
264
|
|
|
262
265
|
// If there is a dispatcher, create and dispatch the event
|
|
263
266
|
if (eventDispatcher != null) {
|
|
264
267
|
int surfaceId = UIManagerHelper.getSurfaceId(reactContext);
|
|
265
|
-
T event = creator.create(surfaceId,
|
|
268
|
+
T event = creator.create(surfaceId, viewId, payload);
|
|
266
269
|
eventDispatcher.dispatchEvent(event);
|
|
267
270
|
}
|
|
268
271
|
}
|
|
@@ -401,25 +404,22 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
401
404
|
}
|
|
402
405
|
});
|
|
403
406
|
|
|
404
|
-
markerCollection.setOnInfoWindowClickListener(
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
event.putString("action", "callout-press");
|
|
409
|
-
// todo: use Fabric events
|
|
410
|
-
// manager.pushEvent(context, view, "onCalloutPress", event);
|
|
407
|
+
markerCollection.setOnInfoWindowClickListener(marker -> {
|
|
408
|
+
WritableMap event = makeClickEventData(marker.getPosition());
|
|
409
|
+
event.putString("action", "callout-press");
|
|
410
|
+
dispatchEvent(event, OnCalloutPressEvent::new);
|
|
411
411
|
|
|
412
|
-
event = makeClickEventData(marker.getPosition());
|
|
413
|
-
event.putString("action", "callout-press");
|
|
414
|
-
MapMarker markerView = getMarkerMap(marker);
|
|
415
|
-
// todo: use Fabric events
|
|
416
|
-
// manager.pushEvent(context, markerView, "onCalloutPress", event);
|
|
417
412
|
|
|
413
|
+
event = makeClickEventData(marker.getPosition());
|
|
414
|
+
event.putString("action", "callout-press");
|
|
415
|
+
MapMarker markerView = getMarkerMap(marker);
|
|
416
|
+
dispatchEvent(event, OnCalloutPressEvent::new, markerView.getId(), context);
|
|
417
|
+
|
|
418
|
+
MapCallout infoWindow = markerView.getCalloutView();
|
|
419
|
+
if (infoWindow != null) {
|
|
418
420
|
event = makeClickEventData(marker.getPosition());
|
|
419
421
|
event.putString("action", "callout-press");
|
|
420
|
-
|
|
421
|
-
// todo: use Fabric events
|
|
422
|
-
// if (infoWindow != null) manager.pushEvent(context, infoWindow, "onPress", event);
|
|
422
|
+
dispatchEvent(event, OnPressEvent::new, infoWindow.getId(), context);
|
|
423
423
|
}
|
|
424
424
|
});
|
|
425
425
|
|
|
@@ -460,6 +460,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
460
460
|
boolean isGesture = GoogleMap.OnCameraMoveStartedListener.REASON_GESTURE == reason;
|
|
461
461
|
WritableMap event = new WritableNativeMap();
|
|
462
462
|
event.putBoolean("isGesture", isGesture);
|
|
463
|
+
// dispatchEvent(event, OnRegionChangeEvent::new);
|
|
463
464
|
// todo: use Fabric events
|
|
464
465
|
// manager.pushEvent(context, view, "onRegionChangeStart", event);
|
|
465
466
|
}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Leland Richardson <leland.m.richardson@gmail.com>",
|
|
7
7
|
"homepage": "https://github.com/react-native-maps/react-native-maps#readme",
|
|
8
|
-
"version": "1.21.0-alpha.
|
|
8
|
+
"version": "1.21.0-alpha.68",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|