react-native-maps 1.21.0-alpha.26 → 1.21.0-alpha.27

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.
@@ -46,7 +46,11 @@ using namespace facebook::react;
46
46
  NSDictionary* regionDic = [RCTConvert dictonaryFromString:regionJSON];
47
47
  MKCoordinateRegion region = [RCTConvert MKCoordinateRegion:regionDic];
48
48
  GMSCameraPosition *camera = [AIRGoogleMap makeGMSCameraPositionFromMap:_view andMKCoordinateRegion:region];
49
- [_view animateToCameraPosition:camera];
49
+ if (duration == 0){
50
+ [_view setRegion:region];
51
+ } else {
52
+ [_view animateToCameraPosition:camera];
53
+ }
50
54
  }
51
55
  - (void)setCamera:(NSString *)cameraJSON{
52
56
  NSDictionary* cameraDic = [RCTConvert dictonaryFromString:cameraJSON];
@@ -935,6 +935,9 @@ static int kDragCenterContext;
935
935
  {
936
936
  // Don't send region did change events until map has
937
937
  // started rendering, as these won't represent the final location
938
+ if (animated && mapView.ignoreRegionChanges){
939
+ mapView.ignoreRegionChanges = false;
940
+ }
938
941
  if(mapView.hasStartedRendering){
939
942
  [self _regionChanged:mapView];
940
943
  }
@@ -47,8 +47,9 @@ using namespace facebook::react;
47
47
  - (void)animateToRegion:(NSString *)regionJSON duration:(NSInteger)duration{
48
48
  NSDictionary* regionDic = [RCTConvert dictonaryFromString:regionJSON];
49
49
  MKCoordinateRegion region = [RCTConvert MKCoordinateRegion:regionDic];
50
- _view.ignoreRegionChanges = YES;
51
- [_view setRegion:region animated:YES];
50
+ Boolean animated = duration == 0 ? NO :YES;
51
+ _view.ignoreRegionChanges = animated;
52
+ [_view setRegion:region animated:animated];
52
53
  }
53
54
  - (void)setCamera:(NSString *)cameraJSON{
54
55
  NSDictionary* cameraDic = [RCTConvert dictonaryFromString:cameraJSON];
package/lib/MapView.d.ts CHANGED
@@ -608,6 +608,7 @@ declare class MapView extends React.Component<MapViewProps, State> {
608
608
  duration?: number;
609
609
  }): void;
610
610
  animateToRegion(region: Region, duration?: number): void;
611
+ setRegion(region: Region): void;
611
612
  fitToElements(options?: FitToOptions): void;
612
613
  fitToSuppliedMarkers(markers: string[], options?: FitToOptions): void;
613
614
  fitToCoordinates(coordinates?: LatLng[], options?: FitToOptions): void;
package/lib/MapView.js CHANGED
@@ -119,6 +119,12 @@ class MapView extends React.Component {
119
119
  MapViewNativeComponent_1.Commands.animateToRegion(this.map.current, region, duration);
120
120
  }
121
121
  }
122
+ setRegion(region) {
123
+ if (this.fabricMap.current) {
124
+ this.fabricMap.current.animateToRegion(region, 0);
125
+ }
126
+ //TODO fix for android
127
+ }
122
128
  fitToElements(options = {}) {
123
129
  const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, animated = true, } = options;
124
130
  if (this.fabricMap.current) {
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.26",
8
+ "version": "1.21.0-alpha.27",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",