react-native-maps 2.0.0-beta.8 → 2.0.0-beta.9

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.
@@ -274,6 +274,11 @@ public class MapManager extends ViewGroupManager<MapView> {
274
274
  }
275
275
  }
276
276
 
277
+ @ReactProp(name = "boundary")
278
+ public void setBoundary(MapView view, ReadableMap boundary) {
279
+ view.setBoundary(boundary);
280
+ }
281
+
277
282
  @Override
278
283
  public void receiveCommand(@NonNull MapView view, String commandId, @Nullable ReadableArray args) {
279
284
  ReadableMap camera;
@@ -287,13 +292,6 @@ public class MapManager extends ViewGroupManager<MapView> {
287
292
  view.animateToCamera(camera, 0);
288
293
  break;
289
294
 
290
- case "setMapBoundaries":
291
- if(args == null) {
292
- break;
293
- }
294
- view.setMapBoundaries(args.getMap(0), args.getMap(1));
295
- break;
296
-
297
295
  case "setIndoorActiveLevelIndex":
298
296
  if(args == null) {
299
297
  break;
@@ -110,6 +110,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
110
110
  private boolean initialCameraSet = false;
111
111
  private LatLngBounds cameraLastIdleBounds;
112
112
  private int cameraMoveReason = 0;
113
+ private LatLngBounds boundary;
113
114
 
114
115
  private static final String[] PERMISSIONS = new String[]{
115
116
  "android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"};
@@ -500,7 +501,42 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
500
501
  }
501
502
  }
502
503
 
504
+ public void setBoundary(ReadableMap boundary) {
505
+ if(boundary == null) {
506
+ this.boundary = null;
507
+ if(map != null) {
508
+ // consumers can pass null to clear boundary
509
+ map.setLatLngBoundsForCameraTarget(null);
510
+ }
511
+ } else {
512
+ LatLngBounds.Builder builder = new LatLngBounds.Builder();
513
+
514
+ ReadableMap northEast = boundary.getMap("northEast");
515
+ ReadableMap southWest = boundary.getMap("southWest");
516
+
517
+ double neLat = northEast.getDouble("latitude");
518
+ double neLng = northEast.getDouble("longitude");
519
+ builder.include(new LatLng(neLat, neLng));
520
+
521
+ double swLat = southWest.getDouble("latitude");
522
+ double swLng = southWest.getDouble("longitude");
523
+ builder.include(new LatLng(swLat, swLng));
524
+
525
+ LatLngBounds bounds = builder.build();
526
+
527
+ this.boundary = bounds;
528
+
529
+ if(map != null) {
530
+ map.setLatLngBoundsForCameraTarget(bounds);
531
+ }
532
+ }
533
+ }
534
+
535
+ // called as soon as the map is ready. Assuming nothing was set on the map at this point.
503
536
  private void applyBridgedProps() {
537
+ if(boundary != null) {
538
+ map.setLatLngBoundsForCameraTarget(boundary);
539
+ }
504
540
  if(initialRegion != null) {
505
541
  moveToRegion(initialRegion);
506
542
  initialRegionSet = true;
@@ -905,24 +941,6 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
905
941
  };
906
942
  }
907
943
 
908
- public void setMapBoundaries(ReadableMap northEast, ReadableMap southWest) {
909
- if (map == null) return;
910
-
911
- LatLngBounds.Builder builder = new LatLngBounds.Builder();
912
-
913
- double latNE = northEast.getDouble("latitude");
914
- double lngNE = northEast.getDouble("longitude");
915
- builder.include(new LatLng(latNE, lngNE));
916
-
917
- double latSW = southWest.getDouble("latitude");
918
- double lngSW = southWest.getDouble("longitude");
919
- builder.include(new LatLng(latSW, lngSW));
920
-
921
- LatLngBounds bounds = builder.build();
922
-
923
- map.setLatLngBoundsForCameraTarget(bounds);
924
- }
925
-
926
944
  // InfoWindowAdapter interface
927
945
 
928
946
  @Override
@@ -30,6 +30,14 @@
30
30
  return [RCTConvert GMSCameraPositionWithDefaults:json existingCamera:nil];
31
31
  }
32
32
 
33
+ + (GMSCoordinateBounds*)GMSCoordinateBounds:(id)json
34
+ {
35
+ json = [self NSDictionary:json];
36
+ CLLocationCoordinate2D northEast = [self CLLocationCoordinate2D:json[@"northEast"]];
37
+ CLLocationCoordinate2D southWest = [self CLLocationCoordinate2D:json[@"southWest"]];
38
+ return [[GMSCoordinateBounds alloc] initWithCoordinate:northEast coordinate:southWest];
39
+ }
40
+
33
41
  + (GMSCameraPosition*)GMSCameraPositionWithDefaults:(id)json existingCamera:(GMSCameraPosition*)existingCamera
34
42
  {
35
43
  CLLocationDegrees latitude = 0;
@@ -305,6 +305,10 @@ id regionAsJSON(MKCoordinateRegion region) {
305
305
  }
306
306
  }
307
307
 
308
+ - (void)setBoundary:(GMSCoordinateBounds*)boundary {
309
+ self.cameraTargetBounds = boundary;
310
+ }
311
+
308
312
  - (void)didPrepareMap {
309
313
  UIView* mapView = [self valueForKey:@"mapView"]; //GMSVectorMapView
310
314
  [self overrideGestureRecognizersForView:mapView];
@@ -65,47 +65,47 @@ RCT_EXPORT_MODULE(RNMGoogleMap)
65
65
  return map;
66
66
  }
67
67
 
68
- RCT_EXPORT_VIEW_PROPERTY(isAccessibilityElement, BOOL)
69
- RCT_REMAP_VIEW_PROPERTY(testID, accessibilityIdentifier, NSString)
68
+ RCT_EXPORT_VIEW_PROPERTY(boundary, GMSCoordinateBounds*)
69
+ RCT_EXPORT_VIEW_PROPERTY(customMapStyleString, NSString)
70
70
  RCT_EXPORT_VIEW_PROPERTY(initialCamera, GMSCameraPosition)
71
- RCT_REMAP_VIEW_PROPERTY(camera, cameraProp, GMSCameraPosition)
72
71
  RCT_EXPORT_VIEW_PROPERTY(initialRegion, MKCoordinateRegion)
72
+ RCT_EXPORT_VIEW_PROPERTY(isAccessibilityElement, BOOL)
73
+ RCT_EXPORT_VIEW_PROPERTY(kmlSrc, NSString)
74
+ RCT_EXPORT_VIEW_PROPERTY(mapPadding, UIEdgeInsets)
75
+ RCT_EXPORT_VIEW_PROPERTY(mapType, GMSMapViewType)
76
+ RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, CGFloat)
77
+ RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, CGFloat)
78
+ RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock)
79
+ RCT_EXPORT_VIEW_PROPERTY(onIndoorBuildingFocused, RCTDirectEventBlock)
80
+ RCT_EXPORT_VIEW_PROPERTY(onIndoorLevelActivated, RCTDirectEventBlock)
81
+ RCT_EXPORT_VIEW_PROPERTY(onKmlReady, RCTBubblingEventBlock)
82
+ RCT_EXPORT_VIEW_PROPERTY(onLongPress, RCTBubblingEventBlock)
83
+ RCT_EXPORT_VIEW_PROPERTY(onMapLoaded, RCTBubblingEventBlock)
84
+ RCT_EXPORT_VIEW_PROPERTY(onMapReady, RCTBubblingEventBlock)
85
+ RCT_EXPORT_VIEW_PROPERTY(onMarkerPress, RCTDirectEventBlock)
86
+ RCT_EXPORT_VIEW_PROPERTY(onPanDrag, RCTBubblingEventBlock)
87
+ RCT_EXPORT_VIEW_PROPERTY(onPoiClick, RCTDirectEventBlock)
88
+ RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
89
+ RCT_EXPORT_VIEW_PROPERTY(onRegionChange, RCTDirectEventBlock)
90
+ RCT_EXPORT_VIEW_PROPERTY(onRegionChangeComplete, RCTDirectEventBlock)
91
+ RCT_EXPORT_VIEW_PROPERTY(onUserLocationChange, RCTBubblingEventBlock)
92
+ RCT_EXPORT_VIEW_PROPERTY(pitchEnabled, BOOL)
73
93
  RCT_EXPORT_VIEW_PROPERTY(region, MKCoordinateRegion)
94
+ RCT_EXPORT_VIEW_PROPERTY(rotateEnabled, BOOL)
95
+ RCT_EXPORT_VIEW_PROPERTY(scrollDuringRotateOrZoomEnabled, BOOL)
96
+ RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL)
74
97
  RCT_EXPORT_VIEW_PROPERTY(showsBuildings, BOOL)
75
98
  RCT_EXPORT_VIEW_PROPERTY(showsCompass, BOOL)
76
- //RCT_EXPORT_VIEW_PROPERTY(showsScale, BOOL) // Not supported by GoogleMaps
99
+ RCT_EXPORT_VIEW_PROPERTY(showsIndoorLevelPicker, BOOL)
100
+ RCT_EXPORT_VIEW_PROPERTY(showsIndoors, BOOL)
101
+ RCT_EXPORT_VIEW_PROPERTY(showsMyLocationButton, BOOL)
77
102
  RCT_EXPORT_VIEW_PROPERTY(showsTraffic, BOOL)
103
+ RCT_EXPORT_VIEW_PROPERTY(showsUserLocation, BOOL)
78
104
  RCT_EXPORT_VIEW_PROPERTY(zoomEnabled, BOOL)
79
- RCT_EXPORT_VIEW_PROPERTY(rotateEnabled, BOOL)
80
- RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL)
81
- RCT_EXPORT_VIEW_PROPERTY(scrollDuringRotateOrZoomEnabled, BOOL)
82
- RCT_EXPORT_VIEW_PROPERTY(pitchEnabled, BOOL)
83
105
  RCT_EXPORT_VIEW_PROPERTY(zoomTapEnabled, BOOL)
84
- RCT_EXPORT_VIEW_PROPERTY(showsUserLocation, BOOL)
85
- RCT_EXPORT_VIEW_PROPERTY(showsMyLocationButton, BOOL)
86
- RCT_EXPORT_VIEW_PROPERTY(showsIndoors, BOOL)
87
- RCT_EXPORT_VIEW_PROPERTY(showsIndoorLevelPicker, BOOL)
88
- RCT_EXPORT_VIEW_PROPERTY(customMapStyleString, NSString)
89
- RCT_EXPORT_VIEW_PROPERTY(mapPadding, UIEdgeInsets)
106
+ RCT_REMAP_VIEW_PROPERTY(camera, cameraProp, GMSCameraPosition)
90
107
  RCT_REMAP_VIEW_PROPERTY(paddingAdjustmentBehavior, paddingAdjustmentBehaviorString, NSString)
91
- RCT_EXPORT_VIEW_PROPERTY(onMapReady, RCTBubblingEventBlock)
92
- RCT_EXPORT_VIEW_PROPERTY(onMapLoaded, RCTBubblingEventBlock)
93
- RCT_EXPORT_VIEW_PROPERTY(onKmlReady, RCTBubblingEventBlock)
94
- RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
95
- RCT_EXPORT_VIEW_PROPERTY(onLongPress, RCTBubblingEventBlock)
96
- RCT_EXPORT_VIEW_PROPERTY(onPanDrag, RCTBubblingEventBlock)
97
- RCT_EXPORT_VIEW_PROPERTY(onUserLocationChange, RCTBubblingEventBlock)
98
- RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock)
99
- RCT_EXPORT_VIEW_PROPERTY(onMarkerPress, RCTDirectEventBlock)
100
- RCT_EXPORT_VIEW_PROPERTY(onRegionChange, RCTDirectEventBlock)
101
- RCT_EXPORT_VIEW_PROPERTY(onRegionChangeComplete, RCTDirectEventBlock)
102
- RCT_EXPORT_VIEW_PROPERTY(onPoiClick, RCTDirectEventBlock)
103
- RCT_EXPORT_VIEW_PROPERTY(onIndoorLevelActivated, RCTDirectEventBlock)
104
- RCT_EXPORT_VIEW_PROPERTY(onIndoorBuildingFocused, RCTDirectEventBlock)
105
- RCT_EXPORT_VIEW_PROPERTY(mapType, GMSMapViewType)
106
- RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, CGFloat)
107
- RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, CGFloat)
108
- RCT_EXPORT_VIEW_PROPERTY(kmlSrc, NSString)
108
+ RCT_REMAP_VIEW_PROPERTY(testID, accessibilityIdentifier, NSString)
109
109
 
110
110
  RCT_EXPORT_METHOD(setCamera:(nonnull NSNumber *)reactTag
111
111
  camera:(id)json)
@@ -122,24 +122,6 @@ RCT_EXPORT_METHOD(setCamera:(nonnull NSNumber *)reactTag
122
122
  }];
123
123
  }
124
124
 
125
- RCT_EXPORT_METHOD(setMapBoundaries:(nonnull NSNumber *)reactTag
126
- northEast:(CLLocationCoordinate2D)northEast
127
- southWest:(CLLocationCoordinate2D)southWest)
128
- {
129
- [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
130
- id view = viewRegistry[reactTag];
131
- if (![view isKindOfClass:[RNMGoogleMap class]]) {
132
- RCTLogError(@"Invalid view returned from registry, expecting RNMGoogleMap, got: %@", view);
133
- } else {
134
- RNMGoogleMap *mapView = (RNMGoogleMap *)view;
135
-
136
- GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithCoordinate:northEast coordinate:southWest];
137
-
138
- mapView.cameraTargetBounds = bounds;
139
- }
140
- }];
141
- }
142
-
143
125
  RCT_EXPORT_METHOD(setIndoorActiveLevelIndex:(nonnull NSNumber *)reactTag
144
126
  levelIndex:(NSInteger) levelIndex)
145
127
  {
@@ -56,6 +56,23 @@
56
56
  return camera;
57
57
  }
58
58
 
59
+ + (MKMapCameraBoundary *)MKMapCameraBoundary:(id)json
60
+ {
61
+ json = [self NSDictionary:json];
62
+ CLLocationCoordinate2D northEast = [self CLLocationCoordinate2D:json[@"northEast"]];
63
+ CLLocationCoordinate2D southWest = [self CLLocationCoordinate2D:json[@"southWest"]];
64
+ MKCoordinateSpan span = {
65
+ northEast.latitude - southWest.latitude,
66
+ northEast.longitude - southWest.longitude
67
+ };
68
+ CLLocationCoordinate2D center = {
69
+ (northEast.latitude + southWest.latitude) / 2,
70
+ (northEast.longitude + southWest.longitude) / 2
71
+ };
72
+
73
+ MKCoordinateRegion region = {center, span};
74
+ return [[MKMapCameraBoundary alloc] initWithCoordinateRegion:region];
75
+ }
59
76
 
60
77
  RCT_ENUM_CONVERTER(MKMapType, (@{
61
78
  @"standard": @(MKMapTypeStandard),
package/ios/Maps/RNMMap.m CHANGED
@@ -340,6 +340,10 @@ const NSInteger RNMMapMaxZoomLevel = 20;
340
340
  ];
341
341
  }
342
342
 
343
+ - (void)setBoundary:(MKMapCameraBoundary*)boundary {
344
+ [self setCameraBoundary:boundary animated:NO];
345
+ }
346
+
343
347
  - (void)setShowsUserLocation:(BOOL)showsUserLocation
344
348
  {
345
349
  if (self.showsUserLocation != showsUserLocation) {
@@ -81,57 +81,60 @@ RCT_EXPORT_MODULE(RNMMap)
81
81
  return map;
82
82
  }
83
83
 
84
- RCT_EXPORT_VIEW_PROPERTY(isAccessibilityElement, BOOL)
85
- RCT_REMAP_VIEW_PROPERTY(testID, accessibilityIdentifier, NSString)
86
- RCT_EXPORT_VIEW_PROPERTY(showsUserLocation, BOOL)
87
- RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor)
88
- RCT_EXPORT_VIEW_PROPERTY(userLocationAnnotationTitle, NSString)
89
- RCT_EXPORT_VIEW_PROPERTY(userInterfaceStyle, NSString)
84
+ RCT_EXPORT_VIEW_PROPERTY(boundary, MKMapCameraBoundary*)
85
+ RCT_EXPORT_VIEW_PROPERTY(cacheEnabled, BOOL)
86
+ RCT_EXPORT_VIEW_PROPERTY(compassOffset, CGPoint)
90
87
  RCT_EXPORT_VIEW_PROPERTY(followsUserLocation, BOOL)
91
- RCT_EXPORT_VIEW_PROPERTY(userLocationCalloutEnabled, BOOL)
92
- RCT_EXPORT_VIEW_PROPERTY(showsPointsOfInterest, BOOL)
93
- RCT_EXPORT_VIEW_PROPERTY(showsBuildings, BOOL)
94
- RCT_EXPORT_VIEW_PROPERTY(showsCompass, BOOL)
95
- RCT_EXPORT_VIEW_PROPERTY(showsScale, BOOL)
96
- RCT_EXPORT_VIEW_PROPERTY(showsTraffic, BOOL)
97
- RCT_EXPORT_VIEW_PROPERTY(zoomEnabled, BOOL)
88
+ RCT_EXPORT_VIEW_PROPERTY(handlePanDrag, BOOL)
89
+ RCT_EXPORT_VIEW_PROPERTY(isAccessibilityElement, BOOL)
98
90
  RCT_EXPORT_VIEW_PROPERTY(kmlSrc, NSString)
99
- RCT_EXPORT_VIEW_PROPERTY(rotateEnabled, BOOL)
100
- RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL)
101
- RCT_EXPORT_VIEW_PROPERTY(pitchEnabled, BOOL)
102
- RCT_EXPORT_VIEW_PROPERTY(cacheEnabled, BOOL)
103
- RCT_EXPORT_VIEW_PROPERTY(loadingEnabled, BOOL)
91
+ RCT_EXPORT_VIEW_PROPERTY(legalLabelInsets, UIEdgeInsets)
104
92
  RCT_EXPORT_VIEW_PROPERTY(loadingBackgroundColor, UIColor)
93
+ RCT_EXPORT_VIEW_PROPERTY(loadingEnabled, BOOL)
105
94
  RCT_EXPORT_VIEW_PROPERTY(loadingIndicatorColor, UIColor)
106
- RCT_EXPORT_VIEW_PROPERTY(handlePanDrag, BOOL)
107
- RCT_EXPORT_VIEW_PROPERTY(maxDelta, CGFloat)
108
- RCT_EXPORT_VIEW_PROPERTY(minDelta, CGFloat)
109
- RCT_EXPORT_VIEW_PROPERTY(compassOffset, CGPoint)
110
- RCT_EXPORT_VIEW_PROPERTY(legalLabelInsets, UIEdgeInsets)
111
95
  RCT_EXPORT_VIEW_PROPERTY(mapPadding, UIEdgeInsets)
112
96
  RCT_EXPORT_VIEW_PROPERTY(mapType, MKMapType)
113
- RCT_EXPORT_VIEW_PROPERTY(onMapReady, RCTBubblingEventBlock)
97
+ RCT_EXPORT_VIEW_PROPERTY(maxDelta, CGFloat)
98
+ RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, CGFloat)
99
+ RCT_EXPORT_VIEW_PROPERTY(minDelta, CGFloat)
100
+ RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, CGFloat)
101
+ RCT_EXPORT_VIEW_PROPERTY(onCalloutPress, RCTDirectEventBlock)
114
102
  RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock)
115
- RCT_EXPORT_VIEW_PROPERTY(onPanDrag, RCTBubblingEventBlock)
116
- RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
117
- RCT_EXPORT_VIEW_PROPERTY(onLongPress, RCTBubblingEventBlock)
118
103
  RCT_EXPORT_VIEW_PROPERTY(onDoublePress, RCTBubblingEventBlock)
119
- RCT_EXPORT_VIEW_PROPERTY(onMarkerPress, RCTDirectEventBlock)
120
- RCT_EXPORT_VIEW_PROPERTY(onMarkerSelect, RCTDirectEventBlock)
104
+ RCT_EXPORT_VIEW_PROPERTY(onLongPress, RCTBubblingEventBlock)
105
+ RCT_EXPORT_VIEW_PROPERTY(onMapReady, RCTBubblingEventBlock)
121
106
  RCT_EXPORT_VIEW_PROPERTY(onMarkerDeselect, RCTDirectEventBlock)
122
- RCT_EXPORT_VIEW_PROPERTY(onMarkerDragStart, RCTDirectEventBlock)
123
107
  RCT_EXPORT_VIEW_PROPERTY(onMarkerDrag, RCTDirectEventBlock)
124
108
  RCT_EXPORT_VIEW_PROPERTY(onMarkerDragEnd, RCTDirectEventBlock)
125
- RCT_EXPORT_VIEW_PROPERTY(onCalloutPress, RCTDirectEventBlock)
109
+ RCT_EXPORT_VIEW_PROPERTY(onMarkerDragStart, RCTDirectEventBlock)
110
+ RCT_EXPORT_VIEW_PROPERTY(onMarkerPress, RCTDirectEventBlock)
111
+ RCT_EXPORT_VIEW_PROPERTY(onMarkerSelect, RCTDirectEventBlock)
112
+ RCT_EXPORT_VIEW_PROPERTY(onPanDrag, RCTBubblingEventBlock)
113
+ RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
126
114
  RCT_EXPORT_VIEW_PROPERTY(onUserLocationChange, RCTBubblingEventBlock)
127
- RCT_CUSTOM_VIEW_PROPERTY(initialRegion, MKCoordinateRegion, RNMMap)
115
+ RCT_EXPORT_VIEW_PROPERTY(pitchEnabled, BOOL)
116
+ RCT_EXPORT_VIEW_PROPERTY(rotateEnabled, BOOL)
117
+ RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL)
118
+ RCT_EXPORT_VIEW_PROPERTY(showsBuildings, BOOL)
119
+ RCT_EXPORT_VIEW_PROPERTY(showsCompass, BOOL)
120
+ RCT_EXPORT_VIEW_PROPERTY(showsPointsOfInterest, BOOL)
121
+ RCT_EXPORT_VIEW_PROPERTY(showsScale, BOOL)
122
+ RCT_EXPORT_VIEW_PROPERTY(showsTraffic, BOOL)
123
+ RCT_EXPORT_VIEW_PROPERTY(showsUserLocation, BOOL)
124
+ RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor)
125
+ RCT_EXPORT_VIEW_PROPERTY(userInterfaceStyle, NSString)
126
+ RCT_EXPORT_VIEW_PROPERTY(userLocationAnnotationTitle, NSString)
127
+ RCT_EXPORT_VIEW_PROPERTY(userLocationCalloutEnabled, BOOL)
128
+ RCT_EXPORT_VIEW_PROPERTY(zoomEnabled, BOOL)
129
+ RCT_REMAP_VIEW_PROPERTY(testID, accessibilityIdentifier, NSString)
130
+ RCT_CUSTOM_VIEW_PROPERTY(camera, MKMapCamera*, RNMMap)
128
131
  {
129
132
  if (json == nil) return;
130
-
131
- // don't emit region change events when we are setting the initialRegion
133
+
134
+ // don't emit region change events when we are setting the camera
132
135
  BOOL originalIgnore = view.ignoreRegionChanges;
133
136
  view.ignoreRegionChanges = YES;
134
- [view setInitialRegion:[RCTConvert MKCoordinateRegion:json]];
137
+ [view setCamera:[RCTConvert MKMapCamera:json] animated:NO];
135
138
  view.ignoreRegionChanges = originalIgnore;
136
139
  }
137
140
  RCT_CUSTOM_VIEW_PROPERTY(initialCamera, MKMapCamera, RNMMap)
@@ -145,34 +148,28 @@ RCT_CUSTOM_VIEW_PROPERTY(initialCamera, MKMapCamera, RNMMap)
145
148
  view.ignoreRegionChanges = originalIgnore;
146
149
  }
147
150
 
148
-
149
- RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, CGFloat)
150
- RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, CGFloat)
151
-
152
-
153
- RCT_CUSTOM_VIEW_PROPERTY(region, MKCoordinateRegion, RNMMap)
151
+ RCT_CUSTOM_VIEW_PROPERTY(initialRegion, MKCoordinateRegion, RNMMap)
154
152
  {
155
153
  if (json == nil) return;
156
154
 
157
- // don't emit region change events when we are setting the region
155
+ // don't emit region change events when we are setting the initialRegion
158
156
  BOOL originalIgnore = view.ignoreRegionChanges;
159
157
  view.ignoreRegionChanges = YES;
160
- [view setRegion:[RCTConvert MKCoordinateRegion:json] animated:NO];
158
+ [view setInitialRegion:[RCTConvert MKCoordinateRegion:json]];
161
159
  view.ignoreRegionChanges = originalIgnore;
162
160
  }
163
161
 
164
- RCT_CUSTOM_VIEW_PROPERTY(camera, MKMapCamera*, RNMMap)
162
+ RCT_CUSTOM_VIEW_PROPERTY(region, MKCoordinateRegion, RNMMap)
165
163
  {
166
164
  if (json == nil) return;
167
-
168
- // don't emit region change events when we are setting the camera
165
+
166
+ // don't emit region change events when we are setting the region
169
167
  BOOL originalIgnore = view.ignoreRegionChanges;
170
168
  view.ignoreRegionChanges = YES;
171
- [view setCamera:[RCTConvert MKMapCamera:json] animated:NO];
169
+ [view setRegion:[RCTConvert MKCoordinateRegion:json] animated:NO];
172
170
  view.ignoreRegionChanges = originalIgnore;
173
171
  }
174
172
 
175
-
176
173
  #pragma mark exported MapView methods
177
174
 
178
175
  RCT_EXPORT_METHOD(setCamera:(nonnull NSNumber *)reactTag
package/lib/MapView.d.ts CHANGED
@@ -6,6 +6,12 @@ import { Modify } from './sharedTypesInternal';
6
6
  import { MapViewNativeComponentType } from './MapViewNativeComponent';
7
7
  export declare const MAP_TYPES: MapTypes;
8
8
  export type MapViewProps = ViewProps & {
9
+ /**
10
+ * A boundary of an area within which the map’s center needs to remain.
11
+ * @platform iOS: Supported
12
+ * @platform Android: Supported
13
+ */
14
+ boundary?: BoundingBox;
9
15
  /**
10
16
  * If `true` map will be cached and displayed as an image instead of being interactable, for performance usage.
11
17
  *
@@ -592,7 +598,6 @@ declare class MapView extends React.Component<MapViewProps, State> {
592
598
  * @return Promise Promise with the bounding box ({ northEast: <LatLng>, southWest: <LatLng> })
593
599
  */
594
600
  getMapBoundaries(): Promise<BoundingBox>;
595
- setMapBoundaries(northEast: LatLng, southWest: LatLng): void;
596
601
  setIndoorActiveLevelIndex(activeLevelIndex: number): void;
597
602
  /**
598
603
  * Takes a snapshot of the map and saves it to a picture
package/lib/MapView.js CHANGED
@@ -138,11 +138,6 @@ class MapView extends React.Component {
138
138
  }
139
139
  return mapViewModuleMethod('getMapBoundaries')(this._getHandle());
140
140
  }
141
- setMapBoundaries(northEast, southWest) {
142
- if (this.map.current) {
143
- MapViewNativeComponent_1.Commands.setMapBoundaries(this.map.current, northEast, southWest);
144
- }
145
- }
146
141
  setIndoorActiveLevelIndex(activeLevelIndex) {
147
142
  if (this.map.current) {
148
143
  MapViewNativeComponent_1.Commands.setIndoorActiveLevelIndex(this.map.current, activeLevelIndex);
@@ -310,6 +305,7 @@ class MapView extends React.Component {
310
305
  customMapStyleString: this.props.customMapStyle
311
306
  ? JSON.stringify(this.props.customMapStyle)
312
307
  : undefined,
308
+ boundary: this.props.boundary,
313
309
  };
314
310
  }
315
311
  if (react_native_1.Platform.OS === 'android' && this.props.liteMode) {
@@ -156,4 +156,3 @@ export interface MarkersFrames {
156
156
  frame: Frame;
157
157
  };
158
158
  }
159
- export type NativeCommandName = 'animateCamera' | 'animateToRegion' | 'coordinateForPoint' | 'fitToCoordinates' | 'fitToElements' | 'fitToSuppliedMarkers' | 'getAddressFromCoordinates' | 'getCamera' | 'getMapBoundaries' | 'getMarkersFrames' | 'pointForCoordinate' | 'setCamera' | 'setIndoorActiveLevelIndex' | 'setMapBoundaries' | 'takeSnapshot';
@@ -2,11 +2,9 @@
2
2
  import type { HostComponent } from 'react-native';
3
3
  import { NativeProps } from './MapView';
4
4
  import { Camera } from './MapView.types';
5
- import { LatLng } from './sharedTypes';
6
5
  export type MapViewNativeComponentType = HostComponent<NativeProps>;
7
6
  interface NativeCommands {
8
7
  setCamera: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, camera: Partial<Camera>) => void;
9
- setMapBoundaries: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, northEast: LatLng, southWest: LatLng) => void;
10
8
  setIndoorActiveLevelIndex: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, activeLevelIndex: number) => void;
11
9
  }
12
10
  export declare const Commands: NativeCommands;
@@ -6,9 +6,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Commands = void 0;
7
7
  const codegenNativeCommands_1 = __importDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));
8
8
  exports.Commands = (0, codegenNativeCommands_1.default)({
9
- supportedCommands: [
10
- 'setCamera',
11
- 'setMapBoundaries',
12
- 'setIndoorActiveLevelIndex',
13
- ],
9
+ supportedCommands: ['setCamera', 'setIndoorActiveLevelIndex'],
14
10
  });
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",
8
+ "version": "2.0.0-beta.9",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",
@@ -9,7 +9,7 @@ Pod::Spec.new do |s|
9
9
  s.authors = package["author"]
10
10
  s.homepage = package["homepage"]
11
11
  s.license = package["license"]
12
- s.platform = :ios, "11.0"
12
+ s.platform = :ios, "13.0"
13
13
 
14
14
  s.source = { :git => "https://github.com/react-native-maps/react-native-maps.git", :tag=> "v#{s.version}" }
15
15
  s.source_files = "ios/Maps/**/*.{h,m}"