react-native-maps 2.0.0-beta.12 → 2.0.0-beta.14
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.
- package/android/src/main/java/com/rnmaps/maps/MapManager.java +1 -18
- package/android/src/main/java/com/rnmaps/maps/MapView.java +1 -99
- package/ios/GoogleMaps/RNMGoogleMap.h +37 -38
- package/ios/GoogleMaps/RNMGoogleMap.m +1 -1
- package/ios/GoogleMaps/RNMGoogleMapManager.m +1 -1
- package/ios/Maps/RNMMap.h +22 -30
- package/ios/Maps/RNMMap.m +2 -76
- package/ios/Maps/RNMMapManager.m +5 -5
- package/lib/MapView.d.ts +7 -31
- package/package.json +1 -1
|
@@ -2,12 +2,10 @@ package com.rnmaps.maps;
|
|
|
2
2
|
|
|
3
3
|
import android.view.View;
|
|
4
4
|
|
|
5
|
-
import androidx.annotation.NonNull;
|
|
6
5
|
import androidx.annotation.Nullable;
|
|
7
6
|
|
|
8
7
|
import com.facebook.react.bridge.Arguments;
|
|
9
8
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
10
|
-
import com.facebook.react.bridge.ReadableArray;
|
|
11
9
|
import com.facebook.react.bridge.ReadableMap;
|
|
12
10
|
import com.facebook.react.bridge.WritableMap;
|
|
13
11
|
import com.facebook.react.common.MapBuilder;
|
|
@@ -232,26 +230,11 @@ public class MapManager extends ViewGroupManager<MapView> {
|
|
|
232
230
|
view.setCacheEnabled(cacheEnabled);
|
|
233
231
|
}
|
|
234
232
|
|
|
235
|
-
@ReactProp(name = "loadingEnabled", defaultBoolean = false)
|
|
236
|
-
public void setLoadingEnabled(MapView view, boolean loadingEnabled) {
|
|
237
|
-
view.enableMapLoading(loadingEnabled);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
233
|
@ReactProp(name = "moveOnMarkerPress", defaultBoolean = true)
|
|
241
234
|
public void setMoveOnMarkerPress(MapView view, boolean moveOnPress) {
|
|
242
235
|
view.setMoveOnMarkerPress(moveOnPress);
|
|
243
236
|
}
|
|
244
237
|
|
|
245
|
-
@ReactProp(name = "loadingBackgroundColor", customType = "Color")
|
|
246
|
-
public void setLoadingBackgroundColor(MapView view, @Nullable Integer loadingBackgroundColor) {
|
|
247
|
-
view.setLoadingBackgroundColor(loadingBackgroundColor);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
@ReactProp(name = "loadingIndicatorColor", customType = "Color")
|
|
251
|
-
public void setLoadingIndicatorColor(MapView view, @Nullable Integer loadingIndicatorColor) {
|
|
252
|
-
view.setLoadingIndicatorColor(loadingIndicatorColor);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
238
|
@ReactProp(name = "pitchEnabled", defaultBoolean = false)
|
|
256
239
|
public void setPitchEnabled(MapView view, boolean pitchEnabled) {
|
|
257
240
|
view.map.getUiSettings().setTiltGesturesEnabled(pitchEnabled);
|
|
@@ -311,7 +294,7 @@ public class MapManager extends ViewGroupManager<MapView> {
|
|
|
311
294
|
"onIndoorLevelActivated", MapBuilder.of("registrationName", "onIndoorLevelActivated"),
|
|
312
295
|
"onIndoorBuildingFocused", MapBuilder.of("registrationName", "onIndoorBuildingFocused"),
|
|
313
296
|
"onDoublePress", MapBuilder.of("registrationName", "onDoublePress"),
|
|
314
|
-
"
|
|
297
|
+
"onTilesRendered", MapBuilder.of("registrationName", "onTilesRendered")
|
|
315
298
|
));
|
|
316
299
|
|
|
317
300
|
return map;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
|
-
import android.content.res.ColorStateList;
|
|
5
4
|
import android.graphics.Bitmap;
|
|
6
|
-
import android.graphics.Color;
|
|
7
5
|
import android.graphics.Point;
|
|
8
6
|
|
|
9
7
|
import androidx.annotation.NonNull;
|
|
@@ -16,13 +14,10 @@ import android.view.MotionEvent;
|
|
|
16
14
|
import android.view.View;
|
|
17
15
|
import android.view.ViewGroup;
|
|
18
16
|
import android.widget.ImageView;
|
|
19
|
-
import android.widget.ProgressBar;
|
|
20
|
-
import android.widget.RelativeLayout;
|
|
21
17
|
import android.location.Location;
|
|
22
18
|
|
|
23
19
|
import com.facebook.react.bridge.LifecycleEventListener;
|
|
24
20
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
25
|
-
import com.facebook.react.bridge.ReadableArray;
|
|
26
21
|
import com.facebook.react.bridge.ReadableMap;
|
|
27
22
|
import com.facebook.react.bridge.WritableArray;
|
|
28
23
|
import com.facebook.react.bridge.WritableMap;
|
|
@@ -67,7 +62,6 @@ import org.xmlpull.v1.XmlPullParserException;
|
|
|
67
62
|
import java.io.IOException;
|
|
68
63
|
import java.io.InputStream;
|
|
69
64
|
import java.util.ArrayList;
|
|
70
|
-
import java.util.Arrays;
|
|
71
65
|
import java.util.HashMap;
|
|
72
66
|
import java.util.List;
|
|
73
67
|
import java.util.Map;
|
|
@@ -87,13 +81,8 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
87
81
|
private CircleManager.Collection circleCollection;
|
|
88
82
|
private GroundOverlayManager groundOverlayManager;
|
|
89
83
|
private GroundOverlayManager.Collection groundOverlayCollection;
|
|
90
|
-
private ProgressBar mapLoadingProgressBar;
|
|
91
|
-
private RelativeLayout mapLoadingLayout;
|
|
92
84
|
private ImageView cacheImageView;
|
|
93
85
|
private Boolean isMapLoaded = false;
|
|
94
|
-
private Integer loadingBackgroundColor = null;
|
|
95
|
-
private Integer loadingIndicatorColor = null;
|
|
96
|
-
public final int baseMapPadding = 50;
|
|
97
86
|
|
|
98
87
|
private LatLngBounds boundsToMove;
|
|
99
88
|
private CameraUpdate cameraToSet;
|
|
@@ -404,7 +393,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
404
393
|
map.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
|
|
405
394
|
@Override public void onMapLoaded() {
|
|
406
395
|
isMapLoaded = true;
|
|
407
|
-
manager.pushEvent(context, view, "
|
|
396
|
+
manager.pushEvent(context, view, "onTilesRendered", new WritableNativeMap());
|
|
408
397
|
MapView.this.cacheView();
|
|
409
398
|
}
|
|
410
399
|
});
|
|
@@ -665,46 +654,10 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
665
654
|
this.cacheView();
|
|
666
655
|
}
|
|
667
656
|
|
|
668
|
-
public void enableMapLoading(boolean loadingEnabled) {
|
|
669
|
-
if (loadingEnabled && !this.isMapLoaded) {
|
|
670
|
-
this.getMapLoadingLayoutView().setVisibility(View.VISIBLE);
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
|
|
674
657
|
public void setMoveOnMarkerPress(boolean moveOnPress) {
|
|
675
658
|
this.moveOnMarkerPress = moveOnPress;
|
|
676
659
|
}
|
|
677
660
|
|
|
678
|
-
public void setLoadingBackgroundColor(Integer loadingBackgroundColor) {
|
|
679
|
-
this.loadingBackgroundColor = loadingBackgroundColor;
|
|
680
|
-
|
|
681
|
-
if (this.mapLoadingLayout != null) {
|
|
682
|
-
if (loadingBackgroundColor == null) {
|
|
683
|
-
this.mapLoadingLayout.setBackgroundColor(Color.WHITE);
|
|
684
|
-
} else {
|
|
685
|
-
this.mapLoadingLayout.setBackgroundColor(this.loadingBackgroundColor);
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
public void setLoadingIndicatorColor(Integer loadingIndicatorColor) {
|
|
691
|
-
this.loadingIndicatorColor = loadingIndicatorColor;
|
|
692
|
-
if (this.mapLoadingProgressBar != null) {
|
|
693
|
-
Integer color = loadingIndicatorColor;
|
|
694
|
-
if (color == null) {
|
|
695
|
-
color = Color.parseColor("#606060");
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
ColorStateList progressTintList = ColorStateList.valueOf(loadingIndicatorColor);
|
|
699
|
-
ColorStateList secondaryProgressTintList = ColorStateList.valueOf(loadingIndicatorColor);
|
|
700
|
-
ColorStateList indeterminateTintList = ColorStateList.valueOf(loadingIndicatorColor);
|
|
701
|
-
|
|
702
|
-
this.mapLoadingProgressBar.setProgressTintList(progressTintList);
|
|
703
|
-
this.mapLoadingProgressBar.setSecondaryProgressTintList(secondaryProgressTintList);
|
|
704
|
-
this.mapLoadingProgressBar.setIndeterminateTintList(indeterminateTintList);
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
|
|
708
661
|
public void setHandlePanDrag(boolean handlePanDrag) {
|
|
709
662
|
this.handlePanDrag = handlePanDrag;
|
|
710
663
|
}
|
|
@@ -1008,36 +961,6 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
1008
961
|
manager.pushEvent(context, this, "onPoiClick", event);
|
|
1009
962
|
}
|
|
1010
963
|
|
|
1011
|
-
private ProgressBar getMapLoadingProgressBar() {
|
|
1012
|
-
if (this.mapLoadingProgressBar == null) {
|
|
1013
|
-
this.mapLoadingProgressBar = new ProgressBar(getContext());
|
|
1014
|
-
this.mapLoadingProgressBar.setIndeterminate(true);
|
|
1015
|
-
}
|
|
1016
|
-
if (this.loadingIndicatorColor != null) {
|
|
1017
|
-
this.setLoadingIndicatorColor(this.loadingIndicatorColor);
|
|
1018
|
-
}
|
|
1019
|
-
return this.mapLoadingProgressBar;
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
private RelativeLayout getMapLoadingLayoutView() {
|
|
1023
|
-
if (this.mapLoadingLayout == null) {
|
|
1024
|
-
this.mapLoadingLayout = new RelativeLayout(getContext());
|
|
1025
|
-
this.mapLoadingLayout.setBackgroundColor(Color.LTGRAY);
|
|
1026
|
-
this.addView(this.mapLoadingLayout,
|
|
1027
|
-
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
|
1028
|
-
ViewGroup.LayoutParams.MATCH_PARENT));
|
|
1029
|
-
|
|
1030
|
-
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
|
|
1031
|
-
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
|
1032
|
-
params.addRule(RelativeLayout.CENTER_IN_PARENT);
|
|
1033
|
-
this.mapLoadingLayout.addView(this.getMapLoadingProgressBar(), params);
|
|
1034
|
-
|
|
1035
|
-
this.mapLoadingLayout.setVisibility(View.INVISIBLE);
|
|
1036
|
-
}
|
|
1037
|
-
this.setLoadingBackgroundColor(this.loadingBackgroundColor);
|
|
1038
|
-
return this.mapLoadingLayout;
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
964
|
private ImageView getCacheImageView() {
|
|
1042
965
|
if (this.cacheImageView == null) {
|
|
1043
966
|
this.cacheImageView = new ImageView(getContext());
|
|
@@ -1056,41 +979,20 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
1056
979
|
}
|
|
1057
980
|
}
|
|
1058
981
|
|
|
1059
|
-
private void removeMapLoadingProgressBar() {
|
|
1060
|
-
if (this.mapLoadingProgressBar != null) {
|
|
1061
|
-
((ViewGroup) this.mapLoadingProgressBar.getParent()).removeView(this.mapLoadingProgressBar);
|
|
1062
|
-
this.mapLoadingProgressBar = null;
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
private void removeMapLoadingLayoutView() {
|
|
1067
|
-
this.removeMapLoadingProgressBar();
|
|
1068
|
-
if (this.mapLoadingLayout != null) {
|
|
1069
|
-
((ViewGroup) this.mapLoadingLayout.getParent()).removeView(this.mapLoadingLayout);
|
|
1070
|
-
this.mapLoadingLayout = null;
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
982
|
private void cacheView() {
|
|
1075
983
|
if (this.cacheEnabled) {
|
|
1076
984
|
final ImageView cacheImageView = this.getCacheImageView();
|
|
1077
|
-
final RelativeLayout mapLoadingLayout = this.getMapLoadingLayoutView();
|
|
1078
985
|
cacheImageView.setVisibility(View.INVISIBLE);
|
|
1079
|
-
mapLoadingLayout.setVisibility(View.VISIBLE);
|
|
1080
986
|
if (this.isMapLoaded) {
|
|
1081
987
|
this.map.snapshot(new GoogleMap.SnapshotReadyCallback() {
|
|
1082
988
|
@Override public void onSnapshotReady(Bitmap bitmap) {
|
|
1083
989
|
cacheImageView.setImageBitmap(bitmap);
|
|
1084
990
|
cacheImageView.setVisibility(View.VISIBLE);
|
|
1085
|
-
mapLoadingLayout.setVisibility(View.INVISIBLE);
|
|
1086
991
|
}
|
|
1087
992
|
});
|
|
1088
993
|
}
|
|
1089
994
|
} else {
|
|
1090
995
|
this.removeCacheImageView();
|
|
1091
|
-
if (this.isMapLoaded) {
|
|
1092
|
-
this.removeMapLoadingLayoutView();
|
|
1093
|
-
}
|
|
1094
996
|
}
|
|
1095
997
|
}
|
|
1096
998
|
|
|
@@ -18,62 +18,61 @@
|
|
|
18
18
|
@interface RNMGoogleMap : GMSMapView
|
|
19
19
|
|
|
20
20
|
// TODO: don't use MK region?
|
|
21
|
-
@property (nonatomic,
|
|
21
|
+
@property (nonatomic, assign) BOOL pitchEnabled;
|
|
22
|
+
@property (nonatomic, assign) BOOL rotateEnabled;
|
|
23
|
+
@property (nonatomic, assign) BOOL scrollDuringRotateOrZoomEnabled;
|
|
24
|
+
@property (nonatomic, assign) BOOL scrollEnabled;
|
|
25
|
+
@property (nonatomic, assign) BOOL showsBuildings;
|
|
26
|
+
@property (nonatomic, assign) BOOL showsCompass;
|
|
27
|
+
@property (nonatomic, assign) BOOL showsIndoorLevelPicker;
|
|
28
|
+
@property (nonatomic, assign) BOOL showsIndoors;
|
|
29
|
+
@property (nonatomic, assign) BOOL showsMyLocationButton;
|
|
30
|
+
@property (nonatomic, assign) BOOL showsTraffic;
|
|
31
|
+
@property (nonatomic, assign) BOOL showsUserLocation;
|
|
32
|
+
@property (nonatomic, assign) BOOL zoomEnabled;
|
|
33
|
+
@property (nonatomic, assign) BOOL zoomTapEnabled;
|
|
34
|
+
@property (nonatomic, assign) GMSCameraPosition *cameraProp; // Because the base class already has a "camera" prop.
|
|
22
35
|
@property (nonatomic, assign) MKCoordinateRegion initialRegion;
|
|
23
36
|
@property (nonatomic, assign) MKCoordinateRegion region;
|
|
24
|
-
@property (nonatomic, assign) GMSCameraPosition *cameraProp; // Because the base class already has a "camera" prop.
|
|
25
|
-
@property (nonatomic, strong) GMSCameraPosition *initialCamera;
|
|
26
37
|
@property (nonatomic, assign) NSString *customMapStyleString;
|
|
27
|
-
@property (nonatomic, assign)
|
|
38
|
+
@property (nonatomic, assign) NSString *kmlSrc;
|
|
28
39
|
@property (nonatomic, assign) NSString *paddingAdjustmentBehaviorString;
|
|
29
|
-
@property (nonatomic,
|
|
30
|
-
@property (nonatomic, copy) RCTBubblingEventBlock
|
|
40
|
+
@property (nonatomic, assign) UIEdgeInsets mapPadding;
|
|
41
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onChange;
|
|
31
42
|
@property (nonatomic, copy) RCTBubblingEventBlock onKmlReady;
|
|
32
|
-
@property (nonatomic, copy) RCTBubblingEventBlock onPress;
|
|
33
43
|
@property (nonatomic, copy) RCTBubblingEventBlock onLongPress;
|
|
34
|
-
@property (nonatomic, copy) RCTBubblingEventBlock
|
|
35
|
-
@property (nonatomic, copy) RCTBubblingEventBlock onUserLocationChange;
|
|
44
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onMapReady;
|
|
36
45
|
@property (nonatomic, copy) RCTBubblingEventBlock onMarkerPress;
|
|
37
|
-
@property (nonatomic, copy) RCTBubblingEventBlock
|
|
46
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onPanDrag;
|
|
38
47
|
@property (nonatomic, copy) RCTBubblingEventBlock onPoiClick;
|
|
48
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onPress;
|
|
49
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onTilesRendered;
|
|
50
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onUserLocationChange;
|
|
51
|
+
@property (nonatomic, copy) RCTDirectEventBlock onIndoorBuildingFocused;
|
|
52
|
+
@property (nonatomic, copy) RCTDirectEventBlock onIndoorLevelActivated;
|
|
39
53
|
@property (nonatomic, copy) RCTDirectEventBlock onRegionChange;
|
|
40
54
|
@property (nonatomic, copy) RCTDirectEventBlock onRegionChangeComplete;
|
|
41
|
-
@property (nonatomic,
|
|
42
|
-
@property (nonatomic,
|
|
55
|
+
@property (nonatomic, strong) GMSCameraPosition *initialCamera;
|
|
56
|
+
@property (nonatomic, strong) NSMutableArray *circles;
|
|
57
|
+
@property (nonatomic, strong) NSMutableArray *heatmaps;
|
|
43
58
|
@property (nonatomic, strong) NSMutableArray *markers;
|
|
59
|
+
@property (nonatomic, strong) NSMutableArray *overlays;
|
|
44
60
|
@property (nonatomic, strong) NSMutableArray *polygons;
|
|
45
61
|
@property (nonatomic, strong) NSMutableArray *polylines;
|
|
46
|
-
@property (nonatomic, strong) NSMutableArray *circles;
|
|
47
|
-
@property (nonatomic, strong) NSMutableArray *heatmaps;
|
|
48
62
|
@property (nonatomic, strong) NSMutableArray *tiles;
|
|
49
|
-
@property (nonatomic,
|
|
50
|
-
|
|
51
|
-
@property (nonatomic, assign) BOOL showsBuildings;
|
|
52
|
-
@property (nonatomic, assign) BOOL showsTraffic;
|
|
53
|
-
@property (nonatomic, assign) BOOL showsCompass;
|
|
54
|
-
@property (nonatomic, assign) BOOL scrollEnabled;
|
|
55
|
-
@property (nonatomic, assign) BOOL zoomEnabled;
|
|
56
|
-
@property (nonatomic, assign) BOOL rotateEnabled;
|
|
57
|
-
@property (nonatomic, assign) BOOL scrollDuringRotateOrZoomEnabled;
|
|
58
|
-
@property (nonatomic, assign) BOOL pitchEnabled;
|
|
59
|
-
@property (nonatomic, assign) BOOL zoomTapEnabled;
|
|
60
|
-
@property (nonatomic, assign) BOOL showsUserLocation;
|
|
61
|
-
@property (nonatomic, assign) BOOL showsMyLocationButton;
|
|
62
|
-
@property (nonatomic, assign) BOOL showsIndoors;
|
|
63
|
-
@property (nonatomic, assign) BOOL showsIndoorLevelPicker;
|
|
64
|
-
@property (nonatomic, assign) NSString *kmlSrc;
|
|
63
|
+
@property (nonatomic, weak) RCTBridge *bridge;
|
|
65
64
|
|
|
66
|
-
- (void)didPrepareMap;
|
|
67
|
-
- (void)mapViewDidFinishTileRendering;
|
|
68
65
|
- (BOOL)didTapMarker:(GMSMarker *)marker;
|
|
69
|
-
- (
|
|
70
|
-
- (void)didTapPolygon:(GMSPolygon *)polygon;
|
|
71
|
-
- (void)didTapAtCoordinate:(CLLocationCoordinate2D)coordinate;
|
|
72
|
-
- (void)didLongPressAtCoordinate:(CLLocationCoordinate2D)coordinate;
|
|
66
|
+
- (NSArray *)getMapBoundaries;
|
|
73
67
|
- (void)didChangeCameraPosition:(GMSCameraPosition *)position isGesture:(BOOL)isGesture;
|
|
74
|
-
- (void)
|
|
68
|
+
- (void)didLongPressAtCoordinate:(CLLocationCoordinate2D)coordinate;
|
|
69
|
+
- (void)didPrepareMap;
|
|
70
|
+
- (void)didTapAtCoordinate:(CLLocationCoordinate2D)coordinate;
|
|
75
71
|
- (void)didTapPOIWithPlaceID:(NSString *)placeID name:(NSString *) name location:(CLLocationCoordinate2D) location;
|
|
76
|
-
- (
|
|
72
|
+
- (void)didTapPolygon:(GMSPolygon *)polygon;
|
|
73
|
+
- (void)didTapPolyline:(GMSPolyline *)polyline;
|
|
74
|
+
- (void)idleAtCameraPosition:(GMSCameraPosition *)position isGesture:(BOOL)isGesture;
|
|
75
|
+
- (void)mapViewDidFinishTileRendering;
|
|
77
76
|
|
|
78
77
|
+ (MKCoordinateRegion)makeGMSCameraPositionFromMap:(GMSMapView *)map andGMSCameraPosition:(GMSCameraPosition *)position;
|
|
79
78
|
+ (GMSCameraPosition*)makeGMSCameraPositionFromMap:(GMSMapView *)map andMKCoordinateRegion:(MKCoordinateRegion)region;
|
|
@@ -330,7 +330,7 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
- (void)mapViewDidFinishTileRendering {
|
|
333
|
-
if (self.
|
|
333
|
+
if (self.onTilesRendered) self.onTilesRendered(@{});
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
- (BOOL)didTapMarker:(GMSMarker *)marker {
|
|
@@ -81,7 +81,6 @@ RCT_EXPORT_VIEW_PROPERTY(onIndoorBuildingFocused, RCTDirectEventBlock)
|
|
|
81
81
|
RCT_EXPORT_VIEW_PROPERTY(onIndoorLevelActivated, RCTDirectEventBlock)
|
|
82
82
|
RCT_EXPORT_VIEW_PROPERTY(onKmlReady, RCTBubblingEventBlock)
|
|
83
83
|
RCT_EXPORT_VIEW_PROPERTY(onLongPress, RCTBubblingEventBlock)
|
|
84
|
-
RCT_EXPORT_VIEW_PROPERTY(onMapLoaded, RCTBubblingEventBlock)
|
|
85
84
|
RCT_EXPORT_VIEW_PROPERTY(onMapReady, RCTBubblingEventBlock)
|
|
86
85
|
RCT_EXPORT_VIEW_PROPERTY(onMarkerPress, RCTDirectEventBlock)
|
|
87
86
|
RCT_EXPORT_VIEW_PROPERTY(onPanDrag, RCTBubblingEventBlock)
|
|
@@ -89,6 +88,7 @@ RCT_EXPORT_VIEW_PROPERTY(onPoiClick, RCTDirectEventBlock)
|
|
|
89
88
|
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
|
|
90
89
|
RCT_EXPORT_VIEW_PROPERTY(onRegionChange, RCTDirectEventBlock)
|
|
91
90
|
RCT_EXPORT_VIEW_PROPERTY(onRegionChangeComplete, RCTDirectEventBlock)
|
|
91
|
+
RCT_EXPORT_VIEW_PROPERTY(onTilesRendered, RCTBubblingEventBlock)
|
|
92
92
|
RCT_EXPORT_VIEW_PROPERTY(onUserLocationChange, RCTBubblingEventBlock)
|
|
93
93
|
RCT_EXPORT_VIEW_PROPERTY(pitchEnabled, BOOL)
|
|
94
94
|
RCT_EXPORT_VIEW_PROPERTY(region, MKCoordinateRegion)
|
package/ios/Maps/RNMMap.h
CHANGED
|
@@ -23,53 +23,45 @@ extern const NSInteger RNMMapMaxZoomLevel;
|
|
|
23
23
|
|
|
24
24
|
@interface RNMMap: MKMapView<SMCalloutViewDelegate>
|
|
25
25
|
|
|
26
|
-
@property (nonatomic,
|
|
27
|
-
@property (nonatomic, strong) UIImageView *cacheImageView;
|
|
28
|
-
@property (nonatomic, strong) UIView *loadingView;
|
|
29
|
-
|
|
30
|
-
@property (nonatomic, copy) NSString *userLocationAnnotationTitle;
|
|
26
|
+
@property (nonatomic, assign) BOOL cacheEnabled;
|
|
31
27
|
@property (nonatomic, assign) BOOL followUserLocation;
|
|
32
|
-
@property (nonatomic, assign) BOOL userLocationCalloutEnabled;
|
|
33
28
|
@property (nonatomic, assign) BOOL hasStartedRendering;
|
|
34
|
-
@property (nonatomic, assign) BOOL
|
|
35
|
-
@property (nonatomic, assign) BOOL
|
|
36
|
-
@property (nonatomic,
|
|
37
|
-
@property (nonatomic, strong) UIColor *loadingIndicatorColor;
|
|
38
|
-
@property (nonatomic, assign) BOOL hasShownInitialLoading;
|
|
39
|
-
@property (nonatomic, assign) CGFloat minDelta;
|
|
29
|
+
@property (nonatomic, assign) BOOL ignoreRegionChanges;
|
|
30
|
+
@property (nonatomic, assign) BOOL mapLoaded;
|
|
31
|
+
@property (nonatomic, assign) BOOL userLocationCalloutEnabled;
|
|
40
32
|
@property (nonatomic, assign) CGFloat maxDelta;
|
|
41
|
-
@property (nonatomic, assign) UIEdgeInsets legalLabelInsets;
|
|
42
|
-
@property (nonatomic, assign) MKCoordinateRegion initialRegion;
|
|
43
|
-
@property (nonatomic, assign) MKMapCamera *initialCamera;
|
|
44
|
-
@property (nonatomic, assign) CGFloat minZoomLevel;
|
|
45
33
|
@property (nonatomic, assign) CGFloat maxZoomLevel;
|
|
34
|
+
@property (nonatomic, assign) CGFloat minDelta;
|
|
35
|
+
@property (nonatomic, assign) CGFloat minZoomLevel;
|
|
46
36
|
@property (nonatomic, assign) CGPoint compassOffset;
|
|
47
|
-
@property (nonatomic, assign) UIEdgeInsets mapPadding;
|
|
48
|
-
|
|
49
37
|
@property (nonatomic, assign) CLLocationCoordinate2D pendingCenter;
|
|
38
|
+
@property (nonatomic, assign) MKCoordinateRegion initialRegion;
|
|
50
39
|
@property (nonatomic, assign) MKCoordinateSpan pendingSpan;
|
|
40
|
+
@property (nonatomic, assign) MKMapCamera *initialCamera;
|
|
41
|
+
@property (nonatomic, assign) UIEdgeInsets legalLabelInsets;
|
|
42
|
+
@property (nonatomic, assign) UIEdgeInsets mapPadding;
|
|
43
|
+
@property (nonatomic, copy) NSString *userLocationAnnotationTitle;
|
|
44
|
+
@property (nonatomic, strong) SMCalloutView *calloutView;
|
|
45
|
+
@property (nonatomic, strong) UIImageView *cacheImageView;
|
|
51
46
|
|
|
52
|
-
|
|
53
|
-
@property (nonatomic, assign) BOOL ignoreRegionChanges;
|
|
54
|
-
|
|
55
|
-
@property (nonatomic, copy) RCTBubblingEventBlock onMapReady;
|
|
56
47
|
@property (nonatomic, copy) RCTBubblingEventBlock onChange;
|
|
57
|
-
@property (nonatomic, copy) RCTBubblingEventBlock onPress;
|
|
58
|
-
@property (nonatomic, copy) RCTBubblingEventBlock onPanDrag;
|
|
59
48
|
@property (nonatomic, copy) RCTBubblingEventBlock onDoublePress;
|
|
60
49
|
@property (nonatomic, copy) RCTBubblingEventBlock onLongPress;
|
|
61
|
-
@property (nonatomic, copy)
|
|
62
|
-
@property (nonatomic, copy)
|
|
50
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onMapReady;
|
|
51
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onPanDrag;
|
|
52
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onPress;
|
|
53
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onTilesRendered;
|
|
54
|
+
@property (nonatomic, copy) RCTBubblingEventBlock onUserLocationChange;
|
|
55
|
+
@property (nonatomic, copy) RCTDirectEventBlock onCalloutPress;
|
|
63
56
|
@property (nonatomic, copy) RCTDirectEventBlock onMarkerDeselect;
|
|
64
|
-
@property (nonatomic, copy) RCTDirectEventBlock onMarkerDragStart;
|
|
65
57
|
@property (nonatomic, copy) RCTDirectEventBlock onMarkerDrag;
|
|
66
58
|
@property (nonatomic, copy) RCTDirectEventBlock onMarkerDragEnd;
|
|
67
|
-
@property (nonatomic, copy) RCTDirectEventBlock
|
|
59
|
+
@property (nonatomic, copy) RCTDirectEventBlock onMarkerDragStart;
|
|
60
|
+
@property (nonatomic, copy) RCTDirectEventBlock onMarkerPress;
|
|
61
|
+
@property (nonatomic, copy) RCTDirectEventBlock onMarkerSelect;
|
|
68
62
|
@property (nonatomic, copy) RCTDirectEventBlock onRegionChange;
|
|
69
|
-
@property (nonatomic, copy) RCTBubblingEventBlock onUserLocationChange;
|
|
70
63
|
|
|
71
64
|
- (void)cacheViewIfNeeded;
|
|
72
|
-
- (void)beginLoading;
|
|
73
65
|
- (void)finishLoading;
|
|
74
66
|
- (NSArray *)getMapBoundaries;
|
|
75
67
|
|
package/ios/Maps/RNMMap.m
CHANGED
|
@@ -431,43 +431,6 @@ const NSInteger RNMMapMaxZoomLevel = 20;
|
|
|
431
431
|
|
|
432
432
|
- (void)setCacheEnabled:(BOOL)cacheEnabled {
|
|
433
433
|
_cacheEnabled = cacheEnabled;
|
|
434
|
-
if (self.cacheEnabled && self.cacheImageView.image == nil) {
|
|
435
|
-
self.loadingView.hidden = NO;
|
|
436
|
-
[self.activityIndicatorView startAnimating];
|
|
437
|
-
}
|
|
438
|
-
else {
|
|
439
|
-
if (_loadingView != nil) {
|
|
440
|
-
self.loadingView.hidden = YES;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
- (void)setLoadingEnabled:(BOOL)loadingEnabled {
|
|
446
|
-
_loadingEnabled = loadingEnabled;
|
|
447
|
-
if (!self.hasShownInitialLoading) {
|
|
448
|
-
self.loadingView.hidden = !self.loadingEnabled;
|
|
449
|
-
}
|
|
450
|
-
else {
|
|
451
|
-
if (_loadingView != nil) {
|
|
452
|
-
self.loadingView.hidden = YES;
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
- (UIColor *)loadingBackgroundColor {
|
|
458
|
-
return self.loadingView.backgroundColor;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
- (void)setLoadingBackgroundColor:(UIColor *)loadingBackgroundColor {
|
|
462
|
-
self.loadingView.backgroundColor = loadingBackgroundColor;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
- (UIColor *)loadingIndicatorColor {
|
|
466
|
-
return self.activityIndicatorView.color;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
- (void)setLoadingIndicatorColor:(UIColor *)loadingIndicatorColor {
|
|
470
|
-
self.activityIndicatorView.color = loadingIndicatorColor;
|
|
471
434
|
}
|
|
472
435
|
|
|
473
436
|
// Include properties of MKMapView which are only available on iOS 9+
|
|
@@ -549,7 +512,7 @@ const NSInteger RNMMapMaxZoomLevel = 20;
|
|
|
549
512
|
if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateActive) {
|
|
550
513
|
return;
|
|
551
514
|
}
|
|
552
|
-
if (self.
|
|
515
|
+
if (self.mapLoaded) {
|
|
553
516
|
if (!self.cacheEnabled) {
|
|
554
517
|
if (_cacheImageView != nil) {
|
|
555
518
|
self.cacheImageView.hidden = YES;
|
|
@@ -612,48 +575,11 @@ const NSInteger RNMMapMaxZoomLevel = 20;
|
|
|
612
575
|
return self.layoutMargins;
|
|
613
576
|
}
|
|
614
577
|
|
|
615
|
-
- (void)beginLoading {
|
|
616
|
-
if ((!self.hasShownInitialLoading && self.loadingEnabled) || (self.cacheEnabled && self.cacheImageView.image == nil)) {
|
|
617
|
-
self.loadingView.hidden = NO;
|
|
618
|
-
[self.activityIndicatorView startAnimating];
|
|
619
|
-
}
|
|
620
|
-
else {
|
|
621
|
-
if (_loadingView != nil) {
|
|
622
|
-
self.loadingView.hidden = YES;
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
|
|
627
578
|
- (void)finishLoading {
|
|
628
|
-
self.
|
|
629
|
-
if (_loadingView != nil) {
|
|
630
|
-
self.loadingView.hidden = YES;
|
|
631
|
-
}
|
|
579
|
+
self.mapLoaded = YES;
|
|
632
580
|
[self cacheViewIfNeeded];
|
|
633
581
|
}
|
|
634
582
|
|
|
635
|
-
- (UIActivityIndicatorView *)activityIndicatorView {
|
|
636
|
-
if (_activityIndicatorView == nil) {
|
|
637
|
-
_activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
|
|
638
|
-
_activityIndicatorView.center = self.loadingView.center;
|
|
639
|
-
_activityIndicatorView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
|
|
640
|
-
_activityIndicatorView.color = [UIColor colorWithRed:96.f/255.f green:96.f/255.f blue:96.f/255.f alpha:1.f]; // defaults to #606060
|
|
641
|
-
}
|
|
642
|
-
[self.loadingView addSubview:_activityIndicatorView];
|
|
643
|
-
return _activityIndicatorView;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
- (UIView *)loadingView {
|
|
647
|
-
if (_loadingView == nil) {
|
|
648
|
-
_loadingView = [[UIView alloc] initWithFrame:self.bounds];
|
|
649
|
-
_loadingView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
|
|
650
|
-
_loadingView.backgroundColor = [UIColor whiteColor]; // defaults to #FFFFFF
|
|
651
|
-
[self addSubview:_loadingView];
|
|
652
|
-
_loadingView.hidden = NO;
|
|
653
|
-
}
|
|
654
|
-
return _loadingView;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
583
|
- (UIImageView *)cacheImageView {
|
|
658
584
|
if (_cacheImageView == nil) {
|
|
659
585
|
_cacheImageView = [[UIImageView alloc] initWithFrame:self.bounds];
|
package/ios/Maps/RNMMapManager.m
CHANGED
|
@@ -89,9 +89,6 @@ RCT_EXPORT_VIEW_PROPERTY(handlePanDrag, BOOL)
|
|
|
89
89
|
RCT_EXPORT_VIEW_PROPERTY(isAccessibilityElement, BOOL)
|
|
90
90
|
RCT_EXPORT_VIEW_PROPERTY(kmlSrc, NSString)
|
|
91
91
|
RCT_EXPORT_VIEW_PROPERTY(legalLabelInsets, UIEdgeInsets)
|
|
92
|
-
RCT_EXPORT_VIEW_PROPERTY(loadingBackgroundColor, UIColor)
|
|
93
|
-
RCT_EXPORT_VIEW_PROPERTY(loadingEnabled, BOOL)
|
|
94
|
-
RCT_EXPORT_VIEW_PROPERTY(loadingIndicatorColor, UIColor)
|
|
95
92
|
RCT_EXPORT_VIEW_PROPERTY(mapPadding, UIEdgeInsets)
|
|
96
93
|
RCT_EXPORT_VIEW_PROPERTY(mapType, MKMapType)
|
|
97
94
|
RCT_EXPORT_VIEW_PROPERTY(maxDelta, CGFloat)
|
|
@@ -111,6 +108,7 @@ RCT_EXPORT_VIEW_PROPERTY(onMarkerPress, RCTDirectEventBlock)
|
|
|
111
108
|
RCT_EXPORT_VIEW_PROPERTY(onMarkerSelect, RCTDirectEventBlock)
|
|
112
109
|
RCT_EXPORT_VIEW_PROPERTY(onPanDrag, RCTBubblingEventBlock)
|
|
113
110
|
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
|
|
111
|
+
RCT_EXPORT_VIEW_PROPERTY(onTilesRendered, RCTBubblingEventBlock)
|
|
114
112
|
RCT_EXPORT_VIEW_PROPERTY(onUserLocationChange, RCTBubblingEventBlock)
|
|
115
113
|
RCT_EXPORT_VIEW_PROPERTY(pitchEnabled, BOOL)
|
|
116
114
|
RCT_EXPORT_VIEW_PROPERTY(rotateEnabled, BOOL)
|
|
@@ -548,12 +546,14 @@ static int kDragCenterContext;
|
|
|
548
546
|
mapView.onMapReady(@{});
|
|
549
547
|
mapView.hasStartedRendering = YES;
|
|
550
548
|
}
|
|
551
|
-
[mapView beginLoading];
|
|
552
549
|
}
|
|
553
550
|
|
|
554
|
-
- (void)mapViewDidFinishRenderingMap:(RNMMap *)mapView fullyRendered:(BOOL)fullyRendered
|
|
551
|
+
- (void)mapViewDidFinishRenderingMap:(RNMMap *)mapView fullyRendered:(__unused BOOL)fullyRendered
|
|
555
552
|
{
|
|
556
553
|
[mapView finishLoading];
|
|
554
|
+
if (mapView.onTilesRendered) {
|
|
555
|
+
mapView.onTilesRendered(@{});
|
|
556
|
+
}
|
|
557
557
|
}
|
|
558
558
|
|
|
559
559
|
#pragma mark Private
|
package/lib/MapView.d.ts
CHANGED
|
@@ -108,30 +108,6 @@ export type MapViewProps = ViewProps & {
|
|
|
108
108
|
* @platform Android: Supported
|
|
109
109
|
*/
|
|
110
110
|
liteMode?: boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Sets loading background color.
|
|
113
|
-
*
|
|
114
|
-
* @default `#FFFFFF`
|
|
115
|
-
* @platform iOS: Apple Maps only
|
|
116
|
-
* @platform Android: Supported
|
|
117
|
-
*/
|
|
118
|
-
loadingBackgroundColor?: string;
|
|
119
|
-
/**
|
|
120
|
-
* If `true` a loading indicator will show while the map is loading.
|
|
121
|
-
*
|
|
122
|
-
* @default false
|
|
123
|
-
* @platform iOS: Apple Maps only
|
|
124
|
-
* @platform Android: Supported
|
|
125
|
-
*/
|
|
126
|
-
loadingEnabled?: boolean;
|
|
127
|
-
/**
|
|
128
|
-
* Sets loading indicator color.
|
|
129
|
-
*
|
|
130
|
-
* @default `#606060`
|
|
131
|
-
* @platform iOS: Apple Maps only
|
|
132
|
-
* @platform Android: Supported
|
|
133
|
-
*/
|
|
134
|
-
loadingIndicatorColor?: string;
|
|
135
111
|
/**
|
|
136
112
|
* Adds custom padding to each side of the map. Useful when map elements/markers are obscured.
|
|
137
113
|
*
|
|
@@ -227,13 +203,6 @@ export type MapViewProps = ViewProps & {
|
|
|
227
203
|
* @platform Android: Supported
|
|
228
204
|
*/
|
|
229
205
|
onLongPress?: (event: LongPressEvent) => void;
|
|
230
|
-
/**
|
|
231
|
-
* Callback that is called when the map has finished rendering all tiles.
|
|
232
|
-
*
|
|
233
|
-
* @platform iOS: Google Maps only
|
|
234
|
-
* @platform Android: Supported
|
|
235
|
-
*/
|
|
236
|
-
onMapLoaded?: (event: NativeSyntheticEvent<{}>) => void;
|
|
237
206
|
/**
|
|
238
207
|
* Callback that is called once the map is ready.
|
|
239
208
|
*
|
|
@@ -329,6 +298,13 @@ export type MapViewProps = ViewProps & {
|
|
|
329
298
|
* @platform Android: Supported
|
|
330
299
|
*/
|
|
331
300
|
onRegionChangeComplete?: (region: Region, details: Details) => void;
|
|
301
|
+
/**
|
|
302
|
+
* Callback that is called when the map has finished rendering all tiles.
|
|
303
|
+
*
|
|
304
|
+
* @platform iOS: Supported
|
|
305
|
+
* @platform Android: Supported
|
|
306
|
+
*/
|
|
307
|
+
onTilesRendered?: (event: NativeSyntheticEvent<{}>) => void;
|
|
332
308
|
/**
|
|
333
309
|
* Callback that is called when the underlying map figures our users current location
|
|
334
310
|
* (coordinate also includes isFromMockProvider value for Android API 18 and above).
|
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": "2.0.0-beta.
|
|
8
|
+
"version": "2.0.0-beta.14",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|