react-native-maps 1.21.0-alpha.85 → 1.21.0-alpha.87

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.
@@ -0,0 +1,28 @@
1
+ package com.rnmaps.fabric.event;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.bridge.WritableMap;
6
+ import com.facebook.react.uimanager.events.Event;
7
+
8
+ public class OnKmlReadyEvent extends Event<OnKmlReadyEvent> {
9
+ public static final String EVENT_NAME = "topKmlReady";
10
+
11
+ private final WritableMap payload;
12
+
13
+ public OnKmlReadyEvent(int surfaceId, int viewId, WritableMap payload) {
14
+ super(surfaceId, viewId);
15
+ this.payload = payload;
16
+ }
17
+
18
+ @NonNull
19
+ @Override
20
+ public String getEventName() {
21
+ return EVENT_NAME;
22
+ }
23
+
24
+ @Override
25
+ public WritableMap getEventData() {
26
+ return payload;
27
+ }
28
+ }
@@ -1,7 +1,7 @@
1
1
  package com.rnmaps.maps;
2
2
 
3
3
  import android.content.Context;
4
- import android.util.Log;
4
+ import android.graphics.Color;
5
5
 
6
6
  import com.facebook.react.bridge.ReactContext;
7
7
  import com.facebook.react.bridge.ReadableArray;
@@ -42,6 +42,7 @@ public class MapPolygon extends MapFeature {
42
42
 
43
43
  public MapPolygon(Context context) {
44
44
  super(context);
45
+ strokeWidth = 10;
45
46
  }
46
47
 
47
48
  public static Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
@@ -193,6 +194,7 @@ public class MapPolygon extends MapFeature {
193
194
  options.geodesic(geodesic);
194
195
  options.zIndex(zIndex);
195
196
  options.strokePattern(this.pattern);
197
+ options.clickable(this.tappable);
196
198
 
197
199
  if (this.holes != null) {
198
200
  for (int i = 0; i < holes.size(); i++) {
@@ -212,7 +214,6 @@ public class MapPolygon extends MapFeature {
212
214
  public void addToMap(Object collection) {
213
215
  PolygonManager.Collection polygonCollection = (PolygonManager.Collection) collection;
214
216
  polygon = polygonCollection.addPolygon(getPolygonOptions());
215
- polygon.setClickable(this.tappable);
216
217
  }
217
218
 
218
219
  @Override
@@ -12,7 +12,6 @@ import android.location.Location;
12
12
  import androidx.lifecycle.DefaultLifecycleObserver;
13
13
  import androidx.lifecycle.LifecycleOwner;
14
14
 
15
- import android.util.Log;
16
15
  import android.view.GestureDetector;
17
16
  import android.view.MotionEvent;
18
17
  import android.view.View;
@@ -80,6 +79,7 @@ import java.io.InputStream;
80
79
  import java.util.ArrayList;
81
80
  import java.util.Arrays;
82
81
  import java.util.HashMap;
82
+ import java.util.Iterator;
83
83
  import java.util.List;
84
84
  import java.util.Map;
85
85
  import java.util.concurrent.ExecutionException;
@@ -501,8 +501,10 @@ public void onCreate(LifecycleOwner owner) {
501
501
  public void onPolylineClick(@NonNull Polyline polyline) {
502
502
  WritableMap event = makeClickEventData(tapLocation);
503
503
  event.putString("action", "polyline-press");
504
- // todo: use Fabric events
505
- // manager.pushEvent(context, polylineMap.get(polyline), "onPress", event);
504
+ dispatchEvent(event, OnPressEvent::new);
505
+ event = makeClickEventData(tapLocation);
506
+ dispatchEvent(event, OnPressEvent::new, polylineMap.get(polyline).getId(), context);
507
+
506
508
  }
507
509
  });
508
510
 
@@ -550,8 +552,10 @@ public void onCreate(LifecycleOwner owner) {
550
552
  public void onGroundOverlayClick(@NonNull GroundOverlay groundOverlay) {
551
553
  WritableMap event = makeClickEventData(groundOverlay.getPosition());
552
554
  event.putString("action", "overlay-press");
553
- // todo: use Fabric events
554
- // manager.pushEvent(context, overlayMap.get(groundOverlay), "onPress", event);
555
+
556
+ dispatchEvent(event, OnPressEvent::new);
557
+ event = makeClickEventData(groundOverlay.getPosition());
558
+ dispatchEvent(event, OnPressEvent::new,overlayMap.get(groundOverlay).getId(), context);
555
559
  }
556
560
  });
557
561
 
@@ -664,7 +668,8 @@ public void onCreate(LifecycleOwner owner) {
664
668
  OnUserLocationChangeEvent.EVENT_NAME, MapBuilder.of("registrationName", OnUserLocationChangeEvent.EVENT_NAME),
665
669
  OnRegionChangeEvent.EVENT_NAME, MapBuilder.of("registrationName", OnRegionChangeEvent.EVENT_NAME),
666
670
  OnIndoorBuildingFocusedEvent.EVENT_NAME, MapBuilder.of("registrationName", OnIndoorBuildingFocusedEvent.EVENT_NAME),
667
- OnIndoorLevelActivatedEvent.EVENT_NAME, MapBuilder.of("registrationName", OnIndoorLevelActivatedEvent.EVENT_NAME)
671
+ OnIndoorLevelActivatedEvent.EVENT_NAME, MapBuilder.of("registrationName", OnIndoorLevelActivatedEvent.EVENT_NAME),
672
+ OnKmlReadyEvent.EVENT_NAME, MapBuilder.of("registrationName", OnKmlReadyEvent.EVENT_NAME)
668
673
  );
669
674
  }
670
675
 
@@ -1255,15 +1260,16 @@ public void onCreate(LifecycleOwner owner) {
1255
1260
  LatLngBounds.Builder builder = new LatLngBounds.Builder();
1256
1261
 
1257
1262
  boolean addedPosition = false;
1258
-
1259
- for (MapFeature feature : features) {
1260
- if (feature instanceof MapMarker) {
1261
- Marker marker = (Marker) feature.getFeature();
1262
- builder.include(marker.getPosition());
1263
- addedPosition = true;
1264
- }
1265
- // TODO(lmr): may want to include shapes / etc.
1266
- }
1263
+ if (features.size() > 0) {
1264
+ for (MapFeature feature : features) {
1265
+ if (feature instanceof MapMarker) {
1266
+ Marker marker = (Marker) feature.getFeature();
1267
+ builder.include(marker.getPosition());
1268
+ addedPosition = true;
1269
+ }
1270
+ // TODO(lmr): may want to include shapes / etc.
1271
+ }
1272
+ }
1267
1273
  if (addedPosition) {
1268
1274
  LatLngBounds bounds = builder.build();
1269
1275
  CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, 0);
@@ -1642,16 +1648,14 @@ public void onCreate(LifecycleOwner owner) {
1642
1648
  WritableArray markers = new WritableNativeArray();
1643
1649
 
1644
1650
  if (kmlLayer.getContainers() == null) {
1645
- // todo: use Fabric events
1646
- // manager.pushEvent(context, this, "onKmlReady", pointers);
1651
+ dispatchEvent(pointers, OnKmlReadyEvent::new);
1647
1652
  return;
1648
1653
  }
1649
1654
 
1650
1655
  //Retrieve a nested container within the first container
1651
1656
  KmlContainer container = kmlLayer.getContainers().iterator().next();
1652
1657
  if (container == null || container.getContainers() == null) {
1653
- // todo: use Fabric events
1654
- // manager.pushEvent(context, this, "onKmlReady", pointers);
1658
+ dispatchEvent(pointers, OnKmlReadyEvent::new);
1655
1659
  return;
1656
1660
  }
1657
1661
 
@@ -1714,8 +1718,7 @@ public void onCreate(LifecycleOwner owner) {
1714
1718
  }
1715
1719
 
1716
1720
  pointers.putArray("markers", markers);
1717
- // todo: use Fabric events
1718
- // manager.pushEvent(context, this, "onKmlReady", pointers);
1721
+ dispatchEvent(new WritableNativeMap(), OnKmlReadyEvent::new);
1719
1722
 
1720
1723
  } catch (XmlPullParserException | IOException | InterruptedException |
1721
1724
  ExecutionException e) {
package/lib/MapView.d.ts CHANGED
@@ -690,6 +690,7 @@ declare class MapView extends React.Component<MapViewProps, State> {
690
690
  private handleMapPress;
691
691
  private handleMarkerPress;
692
692
  private handleMarkerSelect;
693
+ private handleKmlReady;
693
694
  private handleMarkerDeselect;
694
695
  private handleRegionChange;
695
696
  private handleRegionChangeStarted;
package/lib/MapView.js CHANGED
@@ -319,6 +319,11 @@ class MapView extends React.Component {
319
319
  this.props.onMarkerSelect(event);
320
320
  }
321
321
  };
322
+ handleKmlReady = (event) => {
323
+ if (this.props.onKmlReady) {
324
+ this.props.onKmlReady(event);
325
+ }
326
+ };
322
327
  handleMarkerDeselect = (event) => {
323
328
  if (this.props.onMarkerDeselect) {
324
329
  this.props.onMarkerDeselect(event);
@@ -373,6 +378,7 @@ class MapView extends React.Component {
373
378
  onMarkerPress: this.handleMarkerPress,
374
379
  onMarkerSelect: this.handleMarkerSelect,
375
380
  onMarkerDeselect: this.handleMarkerDeselect,
381
+ onKmlReady: this.handleKmlReady,
376
382
  userInterfaceStyle: userInterfaceStyle,
377
383
  minZoom: minZoomLevel,
378
384
  maxZoom: maxZoomLevel,
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.85",
8
+ "version": "1.21.0-alpha.87",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",