react-native-maps 1.21.0-alpha.11 → 1.21.0-alpha.13

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.
@@ -12,7 +12,7 @@
12
12
 
13
13
  @class AIRGoogleMapMarker;
14
14
 
15
- @interface AIRGMSMarker : GMSAdvancedMarker
15
+ @interface AIRGMSMarker : GMSMarker
16
16
  @property (nonatomic, strong) NSString *identifier;
17
17
  @property (nonatomic, weak) AIRGoogleMapMarker *fakeMarker;
18
18
  @property (nonatomic, copy) RCTBubblingEventBlock onPress;
@@ -69,6 +69,7 @@ id regionAsJSON(MKCoordinateRegion region) {
69
69
  BOOL _didPrepareMap;
70
70
  BOOL _didCallOnMapReady;
71
71
  BOOL _zoomTapEnabled;
72
+ BOOL _isAnimating;
72
73
  NSString* _googleMapId;
73
74
  }
74
75
 
@@ -239,11 +240,11 @@ id regionAsJSON(MKCoordinateRegion region) {
239
240
  // This is where we intercept them and do the appropriate underlying mapview action.
240
241
  if ([subview isKindOfClass:[AIRGoogleMapMarker class]]) {
241
242
  AIRGoogleMapMarker *marker = (AIRGoogleMapMarker*)subview;
242
- marker.realMarker.map = self;
243
+ [marker didInsertInMap:self];
243
244
  [self.markers addObject:marker];
244
245
  } else if ([subview isKindOfClass:[AIRGoogleMapPolygon class]]) {
245
246
  AIRGoogleMapPolygon *polygon = (AIRGoogleMapPolygon*)subview;
246
- polygon.polygon.map = self;
247
+ [polygon didInsertInMap:self];
247
248
  [self.polygons addObject:polygon];
248
249
  } else if ([subview isKindOfClass:[AIRGoogleMapPolyline class]]) {
249
250
  AIRGoogleMapPolyline *polyline = (AIRGoogleMapPolyline*)subview;
@@ -390,7 +391,7 @@ id regionAsJSON(MKCoordinateRegion region) {
390
391
  }
391
392
 
392
393
  - (void)setRegion:(MKCoordinateRegion)region {
393
- // TODO: The JS component is repeatedly setting region unnecessarily. We might want to deal with that in here.
394
+ if (_isAnimating || !CLLocationCoordinate2DIsValid(region.center)) return;
394
395
  _region = region;
395
396
  if(_didLayoutSubviews) {
396
397
  self.camera = [AIRGoogleMap makeGMSCameraPositionFromMap:self andMKCoordinateRegion:region];
@@ -410,6 +411,7 @@ id regionAsJSON(MKCoordinateRegion region) {
410
411
  }
411
412
 
412
413
  - (void)setCameraProp:(GMSCameraPosition*)camera {
414
+ if (_isAnimating || !CLLocationCoordinate2DIsValid([camera target])) return;
413
415
  _initialCamera = camera;
414
416
  if(_didLayoutSubviews) {
415
417
  self.camera = camera;
@@ -491,6 +493,7 @@ id regionAsJSON(MKCoordinateRegion region) {
491
493
  }
492
494
 
493
495
  - (void)willMove:(BOOL)gesture {
496
+ _isAnimating = YES;
494
497
  id event = @{@"isGesture": [NSNumber numberWithBool:gesture]};
495
498
  if (self.onRegionChangeStart) self.onRegionChangeStart(event);
496
499
  }
@@ -524,6 +527,7 @@ id regionAsJSON(MKCoordinateRegion region) {
524
527
  @"isGesture": [NSNumber numberWithBool:isGesture],
525
528
  };
526
529
  if (self.onChange) self.onChange(event); // complete
530
+ _isAnimating = NO;
527
531
  }
528
532
 
529
533
  - (void)setMapPadding:(UIEdgeInsets)mapPadding {
@@ -784,7 +788,7 @@ id regionAsJSON(MKCoordinateRegion region) {
784
788
  NSString *result = [config objectForKey:@"result"];
785
789
  NSString *filePath = [config objectForKey:@"filePath"];
786
790
 
787
-
791
+
788
792
  // TODO: currently we are ignoring width, height, region
789
793
 
790
794
  UIGraphicsBeginImageContextWithOptions(self.frame.size, YES, 0.0f);
@@ -798,14 +802,14 @@ id regionAsJSON(MKCoordinateRegion region) {
798
802
  } else if([format isEqualToString:@"jpg"]) {
799
803
  data = UIImageJPEGRepresentation(image, quality.floatValue);
800
804
  }
801
-
805
+
802
806
  if ([result isEqualToString:@"file"]) {
803
807
  [data writeToFile:filePath atomically:YES];
804
808
  callback(filePath);
805
809
  } else if ([result isEqualToString:@"base64"]) {
806
810
  callback([data base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithCarriageReturn]);
807
811
  }
808
-
812
+
809
813
  UIGraphicsEndImageContext();
810
814
  }
811
815
 
@@ -53,6 +53,8 @@
53
53
  - (void)didDragMarker:(AIRGMSMarker *)marker;
54
54
  - (id)makeEventData;
55
55
  - (id)makeEventData:(NSString *)action;
56
+ - (UIView *) iconView;
57
+ - (void) didInsertInMap:(AIRGoogleMap *) map;
56
58
  @end
57
59
 
58
60
  #endif