react-native-maps 1.18.4 → 1.19.0
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 +2 -1
- package/android/src/main/java/com/rnmaps/maps/MapView.java +4 -0
- package/ios/AirGoogleMaps/AIRGoogleMap.h +2 -0
- package/ios/AirGoogleMaps/AIRGoogleMap.m +16 -2
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +8 -5
- package/ios/AirMaps/AIRMap.h +1 -0
- package/ios/AirMaps/AIRMapManager.m +6 -0
- package/lib/MapView.d.ts +9 -0
- package/package.json +1 -1
|
@@ -444,7 +444,8 @@ public class MapManager extends ViewGroupManager<MapView> {
|
|
|
444
444
|
"onDoublePress", MapBuilder.of("registrationName", "onDoublePress"),
|
|
445
445
|
"onMapLoaded", MapBuilder.of("registrationName", "onMapLoaded"),
|
|
446
446
|
"onMarkerSelect", MapBuilder.of("registrationName", "onMarkerSelect"),
|
|
447
|
-
"onMarkerDeselect", MapBuilder.of("registrationName", "onMarkerDeselect")
|
|
447
|
+
"onMarkerDeselect", MapBuilder.of("registrationName", "onMarkerDeselect"),
|
|
448
|
+
"onRegionChangeStart", MapBuilder.of("registrationName", "onRegionChangeStart")
|
|
448
449
|
));
|
|
449
450
|
|
|
450
451
|
return map;
|
|
@@ -381,6 +381,10 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
381
381
|
@Override
|
|
382
382
|
public void onCameraMoveStarted(int reason) {
|
|
383
383
|
cameraMoveReason = reason;
|
|
384
|
+
boolean isGesture = GoogleMap.OnCameraMoveStartedListener.REASON_GESTURE == reason;
|
|
385
|
+
WritableMap event = new WritableNativeMap();
|
|
386
|
+
event.putBoolean("isGesture", isGesture);
|
|
387
|
+
manager.pushEvent(context, view, "onRegionChangeStart", event);
|
|
384
388
|
}
|
|
385
389
|
});
|
|
386
390
|
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
@property (nonatomic, copy) RCTBubblingEventBlock onMarkerDeselect;
|
|
39
39
|
@property (nonatomic, copy) RCTBubblingEventBlock onChange;
|
|
40
40
|
@property (nonatomic, copy) RCTBubblingEventBlock onPoiClick;
|
|
41
|
+
@property (nonatomic, copy) RCTDirectEventBlock onRegionChangeStart;
|
|
41
42
|
@property (nonatomic, copy) RCTDirectEventBlock onRegionChange;
|
|
42
43
|
@property (nonatomic, copy) RCTDirectEventBlock onRegionChangeComplete;
|
|
43
44
|
@property (nonatomic, copy) RCTDirectEventBlock onIndoorLevelActivated;
|
|
@@ -72,6 +73,7 @@
|
|
|
72
73
|
- (void)didTapPolygon:(GMSPolygon *)polygon;
|
|
73
74
|
- (void)didTapAtCoordinate:(CLLocationCoordinate2D)coordinate;
|
|
74
75
|
- (void)didLongPressAtCoordinate:(CLLocationCoordinate2D)coordinate;
|
|
76
|
+
- (void)willMove:(BOOL)gesture;
|
|
75
77
|
- (void)didChangeCameraPosition:(GMSCameraPosition *)position isGesture:(BOOL)isGesture;
|
|
76
78
|
- (void)idleAtCameraPosition:(GMSCameraPosition *)position isGesture:(BOOL)isGesture;
|
|
77
79
|
- (void)didTapPOIWithPlaceID:(NSString *)placeID name:(NSString *) name location:(CLLocationCoordinate2D) location;
|
|
@@ -97,7 +97,6 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
97
97
|
_tiles = [NSMutableArray array];
|
|
98
98
|
_overlays = [NSMutableArray array];
|
|
99
99
|
_initialCamera = nil;
|
|
100
|
-
_cameraProp = nil;
|
|
101
100
|
_initialRegion = MKCoordinateRegionMake(CLLocationCoordinate2DMake(0.0, 0.0), MKCoordinateSpanMake(0.0, 0.0));
|
|
102
101
|
_region = MKCoordinateRegionMake(CLLocationCoordinate2DMake(0.0, 0.0), MKCoordinateSpanMake(0.0, 0.0));
|
|
103
102
|
_initialRegionSet = false;
|
|
@@ -315,9 +314,19 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
315
314
|
_googleMapId = googleMapId;
|
|
316
315
|
}
|
|
317
316
|
|
|
317
|
+
- (GMSCameraPosition *)cameraProp {
|
|
318
|
+
if(_didLayoutSubviews) {
|
|
319
|
+
return self.camera;
|
|
320
|
+
} else {
|
|
321
|
+
return _initialCamera;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
318
325
|
- (void)setCameraProp:(GMSCameraPosition*)camera {
|
|
319
326
|
_initialCamera = camera;
|
|
320
|
-
|
|
327
|
+
if(_didLayoutSubviews) {
|
|
328
|
+
self.camera = camera;
|
|
329
|
+
}
|
|
321
330
|
}
|
|
322
331
|
|
|
323
332
|
- (void)setOnMapReady:(RCTBubblingEventBlock)onMapReady {
|
|
@@ -394,6 +403,11 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
394
403
|
self.onLongPress([self eventFromCoordinate:coordinate]);
|
|
395
404
|
}
|
|
396
405
|
|
|
406
|
+
- (void)willMove:(BOOL)gesture {
|
|
407
|
+
id event = @{@"isGesture": [NSNumber numberWithBool:gesture]};
|
|
408
|
+
if (self.onRegionChangeStart) self.onRegionChangeStart(event);
|
|
409
|
+
}
|
|
410
|
+
|
|
397
411
|
- (void)didChangeCameraPosition:(GMSCameraPosition *)position isGesture:(BOOL)isGesture{
|
|
398
412
|
id event = @{@"continuous": @YES,
|
|
399
413
|
@"region": regionAsJSON([AIRGoogleMap makeGMSCameraPositionFromMap:self andGMSCameraPosition:position]),
|
|
@@ -117,6 +117,7 @@ RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock)
|
|
|
117
117
|
RCT_EXPORT_VIEW_PROPERTY(onMarkerPress, RCTDirectEventBlock)
|
|
118
118
|
RCT_EXPORT_VIEW_PROPERTY(onMarkerSelect, RCTDirectEventBlock)
|
|
119
119
|
RCT_EXPORT_VIEW_PROPERTY(onMarkerDeselect, RCTDirectEventBlock)
|
|
120
|
+
RCT_EXPORT_VIEW_PROPERTY(onRegionChangeStart, RCTDirectEventBlock)
|
|
120
121
|
RCT_EXPORT_VIEW_PROPERTY(onRegionChange, RCTDirectEventBlock)
|
|
121
122
|
RCT_EXPORT_VIEW_PROPERTY(onRegionChangeComplete, RCTDirectEventBlock)
|
|
122
123
|
RCT_EXPORT_VIEW_PROPERTY(onPoiClick, RCTDirectEventBlock)
|
|
@@ -160,8 +161,8 @@ RCT_EXPORT_METHOD(setCamera:(nonnull NSNumber *)reactTag
|
|
|
160
161
|
RCTLogError(@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view);
|
|
161
162
|
} else {
|
|
162
163
|
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
163
|
-
GMSCameraPosition *camera = [RCTConvert GMSCameraPositionWithDefaults:json existingCamera:[mapView
|
|
164
|
-
[mapView
|
|
164
|
+
GMSCameraPosition *camera = [RCTConvert GMSCameraPositionWithDefaults:json existingCamera:[mapView cameraProp]];
|
|
165
|
+
[mapView setCameraProp:camera];
|
|
165
166
|
}
|
|
166
167
|
}];
|
|
167
168
|
}
|
|
@@ -179,7 +180,7 @@ RCT_EXPORT_METHOD(animateCamera:(nonnull NSNumber *)reactTag
|
|
|
179
180
|
[CATransaction begin];
|
|
180
181
|
[CATransaction setAnimationDuration:duration/1000];
|
|
181
182
|
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
182
|
-
GMSCameraPosition *camera = [RCTConvert GMSCameraPositionWithDefaults:json existingCamera:[mapView
|
|
183
|
+
GMSCameraPosition *camera = [RCTConvert GMSCameraPositionWithDefaults:json existingCamera:[mapView cameraProp]];
|
|
183
184
|
[mapView animateToCameraPosition:camera];
|
|
184
185
|
[CATransaction commit];
|
|
185
186
|
}
|
|
@@ -511,8 +512,10 @@ RCT_EXPORT_METHOD(setIndoorActiveLevelIndex:(nonnull NSNumber *)reactTag
|
|
|
511
512
|
return @{ @"legalNotice": [GMSServices openSourceLicenseInfo] };
|
|
512
513
|
}
|
|
513
514
|
|
|
514
|
-
- (void)mapView:(GMSMapView *)mapView willMove:(BOOL)gesture{
|
|
515
|
-
|
|
515
|
+
- (void)mapView:(GMSMapView *)mapView willMove:(BOOL)gesture {
|
|
516
|
+
self.isGesture = gesture;
|
|
517
|
+
AIRGoogleMap *googleMapView = (AIRGoogleMap *)mapView;
|
|
518
|
+
[googleMapView willMove:gesture];
|
|
516
519
|
}
|
|
517
520
|
|
|
518
521
|
- (void)mapViewDidStartTileRendering:(GMSMapView *)mapView {
|
package/ios/AirMaps/AIRMap.h
CHANGED
|
@@ -67,6 +67,7 @@ extern const NSInteger AIRMapMaxZoomLevel;
|
|
|
67
67
|
@property (nonatomic, copy) RCTDirectEventBlock onMarkerDragEnd;
|
|
68
68
|
|
|
69
69
|
@property (nonatomic, copy) RCTDirectEventBlock onCalloutPress;
|
|
70
|
+
@property (nonatomic, copy) RCTDirectEventBlock onRegionChangeStart;
|
|
70
71
|
@property (nonatomic, copy) RCTDirectEventBlock onRegionChange;
|
|
71
72
|
@property (nonatomic, copy) RCTBubblingEventBlock onUserLocationChange;
|
|
72
73
|
|
|
@@ -113,6 +113,7 @@ RCT_EXPORT_VIEW_PROPERTY(mapType, MKMapType)
|
|
|
113
113
|
RCT_EXPORT_VIEW_PROPERTY(cameraZoomRange, NSDictionary)
|
|
114
114
|
RCT_EXPORT_VIEW_PROPERTY(onMapReady, RCTBubblingEventBlock)
|
|
115
115
|
RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock)
|
|
116
|
+
RCT_EXPORT_VIEW_PROPERTY(onRegionChangeStart, RCTDirectEventBlock)
|
|
116
117
|
RCT_EXPORT_VIEW_PROPERTY(onPanDrag, RCTBubblingEventBlock)
|
|
117
118
|
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
|
|
118
119
|
RCT_EXPORT_VIEW_PROPERTY(onLongPress, RCTBubblingEventBlock)
|
|
@@ -935,6 +936,11 @@ static int kDragCenterContext;
|
|
|
935
936
|
|
|
936
937
|
}
|
|
937
938
|
|
|
939
|
+
- (void)mapView:(AIRMap *)mapView regionWillChangeAnimated:(BOOL)animated
|
|
940
|
+
{
|
|
941
|
+
if (mapView.onRegionChangeStart) mapView.onRegionChangeStart(@{});
|
|
942
|
+
}
|
|
943
|
+
|
|
938
944
|
- (void)mapViewDidChangeVisibleRegion:(AIRMap *)mapView
|
|
939
945
|
{
|
|
940
946
|
[self _regionChanged:mapView];
|
package/lib/MapView.d.ts
CHANGED
|
@@ -314,6 +314,15 @@ export type MapViewProps = ViewProps & {
|
|
|
314
314
|
* @platform Android: Supported
|
|
315
315
|
*/
|
|
316
316
|
onPress?: (event: MapPressEvent) => void;
|
|
317
|
+
/**
|
|
318
|
+
* Callback that is called once before the region changes, such as when the user starts moving the map.
|
|
319
|
+
* `isGesture` property indicates if the move was from the user (true) or an animation (false).
|
|
320
|
+
* **Note**: `isGesture` is supported by Google Maps only.
|
|
321
|
+
*
|
|
322
|
+
* @platform iOS: Supported
|
|
323
|
+
* @platform Android: Supported
|
|
324
|
+
*/
|
|
325
|
+
onRegionChangeStart?: (event: NativeSyntheticEvent<Details>) => void;
|
|
317
326
|
/**
|
|
318
327
|
* Callback that is called continuously when the region changes, such as when a user is dragging the map.
|
|
319
328
|
* `isGesture` property indicates if the move was from the user (true) or an animation (false).
|
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.
|
|
8
|
+
"version": "1.19.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|