react-native-maps 1.21.0-alpha.1 → 1.21.0-alpha.100

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.
Files changed (144) hide show
  1. package/android/build.gradle +86 -51
  2. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  3. package/android/gradlew +1 -2
  4. package/android/src/main/java/com/rnmaps/fabric/CalloutManager.java +77 -0
  5. package/android/src/main/java/com/rnmaps/fabric/CircleManager.java +94 -0
  6. package/android/src/main/java/com/rnmaps/fabric/JSONUtil.java +86 -0
  7. package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +619 -0
  8. package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +258 -0
  9. package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +284 -0
  10. package/android/src/main/java/com/rnmaps/fabric/OverlayManager.java +95 -0
  11. package/android/src/main/java/com/rnmaps/fabric/PolygonManager.java +89 -0
  12. package/android/src/main/java/com/rnmaps/fabric/PolylineManager.java +121 -0
  13. package/android/src/main/java/com/rnmaps/fabric/event/OnCalloutPressEvent.java +25 -0
  14. package/android/src/main/java/com/rnmaps/fabric/event/OnDeselectEvent.java +28 -0
  15. package/android/src/main/java/com/rnmaps/fabric/event/OnDoublePressEvent.java +27 -0
  16. package/android/src/main/java/com/rnmaps/fabric/event/OnDragEndEvent.java +28 -0
  17. package/android/src/main/java/com/rnmaps/fabric/event/OnDragEvent.java +28 -0
  18. package/android/src/main/java/com/rnmaps/fabric/event/OnDragStartEvent.java +28 -0
  19. package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorBuildingFocusedEvent.java +28 -0
  20. package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorLevelActivatedEvent.java +28 -0
  21. package/android/src/main/java/com/rnmaps/fabric/event/OnKmlReadyEvent.java +28 -0
  22. package/android/src/main/java/com/rnmaps/fabric/event/OnLongPressEvent.java +28 -0
  23. package/android/src/main/java/com/rnmaps/fabric/event/OnMapLoadedEvent.java +29 -0
  24. package/android/src/main/java/com/rnmaps/fabric/event/OnMapReadyEvent.java +29 -0
  25. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDeselectEvent.java +28 -0
  26. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEndEvent.java +28 -0
  27. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEvent.java +28 -0
  28. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragStartEvent.java +28 -0
  29. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerPressEvent.java +28 -0
  30. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerSelectEvent.java +28 -0
  31. package/android/src/main/java/com/rnmaps/fabric/event/OnPanDragEvent.java +28 -0
  32. package/android/src/main/java/com/rnmaps/fabric/event/OnPoiClickEvent.java +27 -0
  33. package/android/src/main/java/com/rnmaps/fabric/event/OnPressEvent.java +27 -0
  34. package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeCompleteEvent.java +30 -0
  35. package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeEvent.java +48 -0
  36. package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeStartEvent.java +33 -0
  37. package/android/src/main/java/com/rnmaps/fabric/event/OnSelectEvent.java +28 -0
  38. package/android/src/main/java/com/rnmaps/fabric/event/OnUserLocationChangeEvent.java +28 -0
  39. package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +82 -0
  40. package/android/src/main/java/com/rnmaps/maps/MapCallout.java +18 -0
  41. package/android/src/main/java/com/rnmaps/maps/MapCircle.java +24 -0
  42. package/android/src/main/java/com/rnmaps/maps/MapManager.java +14 -14
  43. package/android/src/main/java/com/rnmaps/maps/MapMarker.java +79 -3
  44. package/android/src/main/java/com/rnmaps/maps/MapModule.java +206 -206
  45. package/android/src/main/java/com/rnmaps/maps/MapOverlay.java +267 -151
  46. package/android/src/main/java/com/rnmaps/maps/MapPolygon.java +31 -1
  47. package/android/src/main/java/com/rnmaps/maps/MapPolyline.java +207 -141
  48. package/android/src/main/java/com/rnmaps/maps/MapPolylineManager.java +1 -16
  49. package/android/src/main/java/com/rnmaps/maps/MapView.java +1654 -1337
  50. package/ios/AirGoogleMaps/AIRGoogleMap.h +8 -2
  51. package/ios/AirGoogleMaps/AIRGoogleMap.m +245 -57
  52. package/ios/AirGoogleMaps/AIRGoogleMapCircle.h +0 -1
  53. package/ios/AirGoogleMaps/AIRGoogleMapCircle.m +23 -11
  54. package/ios/AirGoogleMaps/AIRGoogleMapCoordinate.h +13 -0
  55. package/ios/AirGoogleMaps/AIRGoogleMapCoordinate.m +10 -0
  56. package/ios/AirGoogleMaps/AIRGoogleMapManager.h +7 -0
  57. package/ios/AirGoogleMaps/AIRGoogleMapManager.m +30 -119
  58. package/ios/AirGoogleMaps/AIRGoogleMapMarker.h +2 -0
  59. package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +347 -243
  60. package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +0 -1
  61. package/ios/AirGoogleMaps/AIRGoogleMapOverlay.h +0 -1
  62. package/ios/AirGoogleMaps/AIRGoogleMapPolygon.h +5 -4
  63. package/ios/AirGoogleMaps/AIRGoogleMapPolygon.m +32 -2
  64. package/ios/AirGoogleMaps/AIRGoogleMapPolygonManager.m +3 -3
  65. package/ios/AirGoogleMaps/AIRGoogleMapPolyline.h +3 -3
  66. package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +2 -10
  67. package/ios/AirGoogleMaps/AIRGoogleMapPolylineManager.m +2 -2
  68. package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.h +1 -1
  69. package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +2 -2
  70. package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.h +3 -0
  71. package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.m +18 -0
  72. package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +26 -0
  73. package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +670 -0
  74. package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +25 -0
  75. package/ios/AirGoogleMaps/RNMapsGooglePolygonView.h +26 -0
  76. package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +217 -0
  77. package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +25 -0
  78. package/ios/AirMaps/AIRMap.h +8 -5
  79. package/ios/AirMaps/AIRMap.m +291 -147
  80. package/ios/AirMaps/AIRMapManager.m +12 -21
  81. package/ios/AirMaps/AIRMapMarker.h +1 -0
  82. package/ios/AirMaps/AIRMapMarker.m +165 -103
  83. package/ios/AirMaps/Callout/SMCalloutView.m +1 -1
  84. package/ios/AirMaps/RCTConvert+AirMap.h +4 -0
  85. package/ios/AirMaps/RCTConvert+AirMap.m +2 -0
  86. package/ios/AirMaps/RNMapsAirModule.h +4 -1
  87. package/ios/AirMaps/RNMapsAirModule.mm +42 -172
  88. package/ios/AirMaps/RNMapsAirModuleDelegate.h +24 -0
  89. package/ios/AirMaps/RNMapsHostVewDelegate.h +17 -0
  90. package/ios/AirMaps/RNMapsMapView.h +6 -3
  91. package/ios/AirMaps/RNMapsMapView.mm +348 -329
  92. package/ios/AirMaps/RNMapsMarkerView.h +24 -0
  93. package/ios/AirMaps/RNMapsMarkerView.mm +430 -0
  94. package/ios/AirMaps/RNMapsMarkerViewManager.mm +21 -0
  95. package/ios/AirMaps/UIView +AirMap.m +20 -0
  96. package/ios/AirMaps/UIView+AirMap.h +11 -0
  97. package/ios/AirMaps.xcodeproj/project.pbxproj +60 -0
  98. package/lib/MapCircle.d.ts +1 -1
  99. package/lib/MapHeatmap.d.ts +2 -2
  100. package/lib/MapHeatmap.js +1 -1
  101. package/lib/MapMarker.d.ts +16 -3
  102. package/lib/MapMarker.js +55 -13
  103. package/lib/MapMarkerNativeComponent.js +0 -2
  104. package/lib/MapOverlay.d.ts +2 -1
  105. package/lib/MapOverlay.js +11 -9
  106. package/lib/MapPolygon.d.ts +1 -1
  107. package/lib/MapPolyline.d.ts +7 -7
  108. package/lib/MapView.d.ts +17 -29
  109. package/lib/MapView.js +111 -124
  110. package/lib/MapView.types.d.ts +1 -1
  111. package/lib/{FabricMapView.d.ts → createFabricMap.d.ts} +8 -6
  112. package/lib/createFabricMap.js +188 -0
  113. package/lib/decorateMapComponent.js +40 -0
  114. package/lib/fixImageProp.d.ts +4 -0
  115. package/lib/fixImageProp.js +16 -0
  116. package/lib/specs/NativeAirMapsModule.d.ts +2 -2
  117. package/lib/specs/NativeComponentCallout.d.ts +46 -0
  118. package/lib/specs/NativeComponentCallout.js +9 -0
  119. package/lib/specs/NativeComponentCircle.d.ts +74 -0
  120. package/lib/specs/NativeComponentCircle.js +7 -0
  121. package/lib/specs/NativeComponentGoogleMapView.d.ts +713 -0
  122. package/lib/specs/NativeComponentGoogleMapView.js +22 -0
  123. package/lib/specs/NativeComponentGooglePolygon.d.ts +75 -0
  124. package/lib/specs/NativeComponentGooglePolygon.js +7 -0
  125. package/lib/specs/NativeComponentMapView.d.ts +32 -47
  126. package/lib/specs/NativeComponentMapView.js +2 -3
  127. package/lib/specs/NativeComponentMarker.d.ts +258 -0
  128. package/lib/specs/NativeComponentMarker.js +19 -0
  129. package/lib/specs/NativeComponentOverlay.d.ts +67 -0
  130. package/lib/specs/NativeComponentOverlay.js +7 -0
  131. package/lib/specs/NativeComponentPolyline.d.ts +101 -0
  132. package/lib/specs/NativeComponentPolyline.js +7 -0
  133. package/package.json +27 -22
  134. package/react-native-maps.podspec +61 -16
  135. package/specs/NativeAirMapsModule.ts +36 -0
  136. package/specs/NativeComponentCallout.ts +63 -0
  137. package/specs/NativeComponentCircle.ts +94 -0
  138. package/specs/NativeComponentGoogleMapView.ts +916 -0
  139. package/specs/NativeComponentGooglePolygon.ts +94 -0
  140. package/specs/NativeComponentMapView.ts +1071 -0
  141. package/specs/NativeComponentMarker.ts +326 -0
  142. package/specs/NativeComponentOverlay.ts +89 -0
  143. package/specs/NativeComponentPolyline.ts +124 -0
  144. package/lib/FabricMapView.js +0 -175
@@ -7,16 +7,17 @@
7
7
  //
8
8
 
9
9
  #import "RNMapsMapView.h"
10
- #import "AirMap.h"
10
+ #import "AIRMap.h"
11
11
  #import "AIRMapMarker.h"
12
12
  #import "AIRMapManager.h"
13
+ #import "RNMapsMarkerView.h"
13
14
  #import <react/renderer/components/RNMapsSpecs/ComponentDescriptors.h>
14
15
  #import <react/renderer/components/RNMapsSpecs/EventEmitters.h>
15
16
  #import <react/renderer/components/RNMapsSpecs/Props.h>
16
17
  #import <react/renderer/components/RNMapsSpecs/RCTComponentViewHelpers.h>
17
-
18
18
  #import "RCTFabricComponentsPlugins.h"
19
19
  #import <React/RCTConversions.h>
20
+ #import "UIView+AirMap.h"
20
21
 
21
22
  using namespace facebook::react;
22
23
 
@@ -29,16 +30,26 @@ using namespace facebook::react;
29
30
  }
30
31
 
31
32
 
32
- - (AIRMap *) mapView {
33
+ - (id<RNMapsAirModuleDelegate>) mapView {
33
34
  return _view;
34
35
  }
35
36
 
37
+ - (void) prepareForRecycle
38
+ {
39
+ [super prepareForRecycle];
40
+ [_view removeFromSuperview];
41
+ _view = nil;
42
+ _legacyMapManager = nil;
43
+ self.contentView = nil;
44
+ }
45
+
36
46
  #pragma mark - JS Commands
37
47
  - (void)animateToRegion:(NSString *)regionJSON duration:(NSInteger)duration{
38
48
  NSDictionary* regionDic = [RCTConvert dictonaryFromString:regionJSON];
39
- [AIRMap animateWithDuration:duration/1000 animations:^{
40
- [self->_view setRegion:[RCTConvert MKCoordinateRegion:regionDic] animated:YES];
41
- }];
49
+ MKCoordinateRegion region = [RCTConvert MKCoordinateRegion:regionDic];
50
+ Boolean animated = duration == 0 ? NO :YES;
51
+ _view.ignoreRegionChanges = animated;
52
+ [_view setRegion:region animated:animated];
42
53
  }
43
54
  - (void)setCamera:(NSString *)cameraJSON{
44
55
  NSDictionary* cameraDic = [RCTConvert dictonaryFromString:cameraJSON];
@@ -49,16 +60,9 @@ using namespace facebook::react;
49
60
  - (void)animateCamera:(NSString *)cameraJSON duration:(NSInteger)duration{
50
61
  NSDictionary* cameraDic = [RCTConvert dictonaryFromString:cameraJSON];
51
62
  MKMapCamera *camera = [RCTConvert MKMapCameraWithDefaults:cameraDic existingCamera:[_view camera]];
52
-
53
63
  // don't emit region change events when we are setting the camera
54
- BOOL originalIgnore = _view.ignoreRegionChanges;
55
64
  _view.ignoreRegionChanges = YES;
56
- [AIRMap animateWithDuration:duration/1000 animations:^{
57
- [self->_view setCamera:camera animated:YES];
58
- } completion:^(BOOL finished){
59
- self->_view.ignoreRegionChanges = originalIgnore;
60
- }];
61
-
65
+ [_view setCamera:camera animated:YES];
62
66
  }
63
67
 
64
68
  - (void)fitToElements:(NSString *)edgePaddingJSON animated:(BOOL)animated {
@@ -73,12 +77,26 @@ using namespace facebook::react;
73
77
  }];
74
78
  NSArray *filteredMarkers = [_view.annotations filteredArrayUsingPredicate:filterMarkers];
75
79
  [_view showAnnotations:filteredMarkers animated:animated];
76
-
77
80
  }
78
81
  - (void)fitToCoordinates:(NSString *)coordinatesJSON edgePaddingJSON:(NSString *)edgePaddingJSON animated:(BOOL)animated {
82
+ NSArray* coordinatesArr = [RCTConvert arrayFromString:coordinatesJSON];
83
+ NSMutableArray<AIRMapCoordinate*>* mutableArray = [NSMutableArray new];
84
+ for (id json : coordinatesArr){
85
+ [mutableArray addObject:[RCTConvert AIRMapCoordinate:json]];
86
+ }
87
+
88
+ NSDictionary* edgePadding = [RCTConvert dictonaryFromString:edgePaddingJSON];
89
+
90
+ UIEdgeInsets edgeInsets = [RCTConvert UIEdgeInsets:edgePadding];
91
+ [_view fitToCoordinates:mutableArray edgePadding:edgeInsets animated:animated];
79
92
 
80
93
  }
81
94
 
95
+ - (void) setIndoorActiveLevelIndex:(NSInteger) activeLevelIndex
96
+ {
97
+ // do nothing (google only)
98
+ }
99
+
82
100
  #pragma mark - Native commands
83
101
 
84
102
  - (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
@@ -89,310 +107,297 @@ using namespace facebook::react;
89
107
 
90
108
  + (ComponentDescriptorProvider)componentDescriptorProvider
91
109
  {
92
- return concreteComponentDescriptorProvider<RNMapsMapViewComponentDescriptor>();
110
+ return concreteComponentDescriptorProvider<RNMapsMapViewComponentDescriptor>();
93
111
  }
94
112
 
95
-
96
- - (instancetype)initWithFrame:(CGRect)frame
113
+ - (void) prepareMapView
97
114
  {
98
- if (self = [super initWithFrame:frame]) {
115
+ if (_legacyMapManager && _view) return;
99
116
  static const auto defaultProps = std::make_shared<const RNMapsMapViewProps>();
100
117
  _props = defaultProps;
101
- _legacyMapManager = [[AIRMapManager alloc] init];
118
+ _legacyMapManager = [[AIRMapManager alloc] init];
102
119
  _view = (AIRMap *)[_legacyMapManager view];
103
120
 
104
121
  self.contentView = _view;
105
122
 
106
- _view.onPress = [self](NSDictionary* dictionary) {
107
- if (_eventEmitter) {
108
- // Extract values from the NSDictionary
109
- NSDictionary* coordinateDict = dictionary[@"coordinate"];
110
- NSDictionary* positionDict = dictionary[@"position"];
111
-
112
- // Populate the OnMapPressCoordinate struct
113
- facebook::react::RNMapsMapViewEventEmitter::OnPressCoordinate coordinate = {
114
- .latitude = [coordinateDict[@"latitude"] doubleValue],
115
- .longitude = [coordinateDict[@"longitude"] doubleValue],
116
- };
117
-
118
- // Populate the OnMapPressPosition struct
119
- facebook::react::RNMapsMapViewEventEmitter::OnPressPosition position = {
120
- .x = [positionDict[@"x"] doubleValue],
121
- .y = [positionDict[@"y"] doubleValue],
122
- };
123
-
124
- auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
125
- facebook::react::RNMapsMapViewEventEmitter::OnPress data = {
126
- .action = std::string([@"press" UTF8String]),
127
- .position = position,
128
- .coordinate = coordinate
129
- };
130
- mapViewEventEmitter->onPress(data);
131
- }
132
- };
133
-
134
-
135
- _view.onMapReady = [self](NSDictionary* dictionary) {
136
- if (_eventEmitter) {
137
-
138
- auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
139
- facebook::react::RNMapsMapViewEventEmitter::OnMapReady data = {};
140
- mapViewEventEmitter->onMapReady(data);
141
- }
142
- };
143
- _view.onChange = [self](NSDictionary* dictionary) {
144
- if (_eventEmitter) {
145
-
146
- NSDictionary* regionDict = dictionary[@"region"];
147
- auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
148
- facebook::react::RNMapsMapViewEventEmitter::OnRegionChange data = {
149
- .region.latitude = [regionDict[@"latitude"] doubleValue],
150
- .region.longitude = [regionDict[@"longitude"] doubleValue],
151
- .region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
152
- .region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
153
- .continuous = [dictionary[@"continuous"] boolValue],
154
- };
155
- mapViewEventEmitter->onRegionChange(data);
156
- }
157
- };
158
- _view.onDoublePress = [self](NSDictionary* dictionary) {
159
- if (_eventEmitter) {
160
-
161
- NSDictionary* coordinateDict = dictionary[@"coordinate"];
162
- NSDictionary* positionDict = dictionary[@"position"];
163
-
164
- // Populate the OnMapPressCoordinate struct
165
- facebook::react::RNMapsMapViewEventEmitter::OnDoublePressCoordinate coordinate = {
166
- .latitude = [coordinateDict[@"latitude"] doubleValue],
167
- .longitude = [coordinateDict[@"longitude"] doubleValue],
168
- };
169
-
170
- // Populate the OnMapDouplePressPosition struct
171
- facebook::react::RNMapsMapViewEventEmitter::OnDoublePressPosition position = {
172
- .x = [positionDict[@"x"] doubleValue],
173
- .y = [positionDict[@"y"] doubleValue],
174
- };
175
-
176
-
177
- auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
178
- facebook::react::RNMapsMapViewEventEmitter::OnDoublePress data = {
179
- .position = position,
180
- .coordinate = coordinate
181
- };
182
- mapViewEventEmitter->onDoublePress(data);
183
- }
184
- };
185
-
186
- _view.onPanDrag = [self](NSDictionary* dictionary) {
187
- if (_eventEmitter) {
188
-
189
- NSDictionary* coordinateDict = dictionary[@"coordinate"];
190
- NSDictionary* positionDict = dictionary[@"position"];
191
-
192
- // Populate the OnMapPressCoordinate struct
193
- facebook::react::RNMapsMapViewEventEmitter::OnPanDragCoordinate coordinate = {
194
- .latitude = [coordinateDict[@"latitude"] doubleValue],
195
- .longitude = [coordinateDict[@"longitude"] doubleValue],
196
- };
197
-
198
- // Populate the OnMapDouplePressPosition struct
199
- facebook::react::RNMapsMapViewEventEmitter::OnPanDragPosition position = {
200
- .x = [positionDict[@"x"] doubleValue],
201
- .y = [positionDict[@"y"] doubleValue],
202
- };
203
-
204
- auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
205
- facebook::react::RNMapsMapViewEventEmitter::OnPanDrag data = {
206
- .position = position,
207
- .coordinate = coordinate,
208
- };
209
- mapViewEventEmitter->onPanDrag(data);
210
- }
211
- };
212
-
213
- _view.onUserLocationChange = [self](NSDictionary* dictionary) {
214
- if (_eventEmitter) {
215
-
216
- NSDictionary* coordinateDict = dictionary[@"coordinate"];
217
- NSDictionary* errorDict = dictionary[@"error"];
218
-
219
-
220
- // Populate the OnMapPressCoordinate struct
221
- facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChangeCoordinate coordinate = {
222
- .latitude = [coordinateDict[@"latitude"] doubleValue],
223
- .longitude = [coordinateDict[@"longitude"] doubleValue],
224
- };
225
- facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChangeError error = {
226
- .message = std::string([errorDict[@"message"] UTF8String]),
227
- };
228
-
229
-
230
- auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
231
- facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChange data = {
232
- .coordinate = coordinate,
233
- .error = error,
234
- };
235
- mapViewEventEmitter->onUserLocationChange(data);
236
- }
237
- };
238
-
239
- _view.onCalloutPress = [self](NSDictionary* dictionary) {
240
- if (_eventEmitter) {
241
-
242
- NSDictionary* coordinateDict = dictionary[@"coordinate"];
243
- NSDictionary* positionDict = dictionary[@"position"];
244
-
245
- // Populate the OnCalloutPressPoint struct
246
- facebook::react::RNMapsMapViewEventEmitter::OnCalloutPressPoint point = {
247
- .x = [coordinateDict[@"x"] doubleValue],
248
- .y = [coordinateDict[@"y"] doubleValue],
249
- };
250
-
251
-
252
- facebook::react::RNMapsMapViewEventEmitter::OnCalloutPressFrame frame = {
253
- .x = [positionDict[@"x"] doubleValue],
254
- .y = [positionDict[@"y"] doubleValue],
255
- .width = [positionDict[@"width"] doubleValue],
256
- .height = [positionDict[@"height"] doubleValue],
257
- };
258
- /*
259
- std::string action;
260
- OnCalloutPressFrame frame;
261
- std::string id;
262
- OnCalloutPressPoint point;
263
- OnCalloutPressCoordinate coordinate;
264
- OnCalloutPressPosition position;
265
- id event = @{
266
- @"action": calloutSubview ? @"callout-inside-press" : @"callout-press",
267
- @"id": marker.identifier ?: @"unknown",
268
- @"point": @{
269
- @"x": @(touchPointReal.x),
270
- @"y": @(touchPointReal.y),
271
- },
272
- @"frame": @{
273
- @"x": @(bubbleFrame.origin.x),
274
- @"y": @(bubbleFrame.origin.y),
275
- @"width": @(bubbleFrame.size.width),
276
- @"height": @(bubbleFrame.size.height),
277
- }
278
- };
279
- */
280
-
281
- auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
282
- facebook::react::RNMapsMapViewEventEmitter::OnCalloutPress data = {
283
- .action = std::string([dictionary[@"action"] UTF8String]),
284
- .id = std::string([dictionary[@"id"] UTF8String]),
285
- .point = point,
286
- .frame = frame,
287
- };
288
- mapViewEventEmitter->onCalloutPress(data);
289
- }
290
- };
291
-
292
-
293
- _view.onRegionChangeStart = [self](NSDictionary* dictionary) {
294
- if (_eventEmitter) {
295
-
296
- NSDictionary* regionDict = dictionary[@"region"];
297
- auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
298
- facebook::react::RNMapsMapViewEventEmitter::OnRegionChangeStart data = {
299
- .region.latitude = [regionDict[@"latitude"] doubleValue],
300
- .region.longitude = [regionDict[@"longitude"] doubleValue],
301
- .region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
302
- .region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
303
- .continuous = [dictionary[@"continuous"] boolValue],
304
- };
305
- mapViewEventEmitter->onRegionChangeStart(data);
306
- }
307
- };
123
+ _view.onPress = [self](NSDictionary* dictionary) {
124
+ if (_eventEmitter) {
125
+ // Extract values from the NSDictionary
126
+ NSDictionary* coordinateDict = dictionary[@"coordinate"];
127
+ NSDictionary* positionDict = dictionary[@"position"];
128
+
129
+ // Populate the OnMapPressCoordinate struct
130
+ facebook::react::RNMapsMapViewEventEmitter::OnPressCoordinate coordinate = {
131
+ .latitude = [coordinateDict[@"latitude"] doubleValue],
132
+ .longitude = [coordinateDict[@"longitude"] doubleValue],
133
+ };
134
+
135
+ // Populate the OnMapPressPosition struct
136
+ facebook::react::RNMapsMapViewEventEmitter::OnPressPosition position = {
137
+ .x = [positionDict[@"x"] doubleValue],
138
+ .y = [positionDict[@"y"] doubleValue],
139
+ };
140
+
141
+ auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
142
+ facebook::react::RNMapsMapViewEventEmitter::OnPress data = {
143
+ .action = std::string([@"press" UTF8String]),
144
+ .position = position,
145
+ .coordinate = coordinate
146
+ };
147
+ mapViewEventEmitter->onPress(data);
148
+ }
149
+ };
308
150
 
309
151
 
310
- #define HANDLE_MARKER_DRAG_EVENT(eventName, emitterFunction) \
311
- if (_eventEmitter) { \
312
- NSDictionary* coordinateDict = dictionary[@"coordinate"]; \
313
- auto mapViewEventEmitter = \
314
- std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter); \
315
- facebook::react::RNMapsMapViewEventEmitter::eventName data = { \
316
- .coordinate.latitude = [coordinateDict[@"latitude"] doubleValue], \
317
- .coordinate.longitude = [coordinateDict[@"longitude"] doubleValue], \
318
- .id = std::string([[dictionary valueForKey:@"id"] UTF8String]), \
319
- }; \
320
- mapViewEventEmitter->emitterFunction(data); \
321
- }
152
+ _view.onMapReady = [self](NSDictionary* dictionary) {
153
+ if (_eventEmitter) {
322
154
 
155
+ auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
156
+ facebook::react::RNMapsMapViewEventEmitter::OnMapReady data = {};
157
+ mapViewEventEmitter->onMapReady(data);
158
+ }
159
+ };
160
+ _view.onChange = [self](NSDictionary* dictionary) {
161
+ if (_eventEmitter) {
162
+ NSDictionary* regionDict = dictionary[@"region"];
163
+ auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
164
+ facebook::react::RNMapsMapViewEventEmitter::OnRegionChange data = {
165
+ .region.latitude = [regionDict[@"latitude"] doubleValue],
166
+ .region.longitude = [regionDict[@"longitude"] doubleValue],
167
+ .region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
168
+ .region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
169
+ .continuous = [dictionary[@"continuous"] boolValue],
170
+ };
171
+ mapViewEventEmitter->onRegionChange(data);
172
+ }
173
+ };
174
+ _view.onDoublePress = [self](NSDictionary* dictionary) {
175
+ if (_eventEmitter) {
176
+
177
+ NSDictionary* coordinateDict = dictionary[@"coordinate"];
178
+ NSDictionary* positionDict = dictionary[@"position"];
179
+
180
+ // Populate the OnMapPressCoordinate struct
181
+ facebook::react::RNMapsMapViewEventEmitter::OnDoublePressCoordinate coordinate = {
182
+ .latitude = [coordinateDict[@"latitude"] doubleValue],
183
+ .longitude = [coordinateDict[@"longitude"] doubleValue],
184
+ };
185
+
186
+ // Populate the OnMapDouplePressPosition struct
187
+ facebook::react::RNMapsMapViewEventEmitter::OnDoublePressPosition position = {
188
+ .x = [positionDict[@"x"] doubleValue],
189
+ .y = [positionDict[@"y"] doubleValue],
190
+ };
191
+
192
+
193
+ auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
194
+ facebook::react::RNMapsMapViewEventEmitter::OnDoublePress data = {
195
+ .position = position,
196
+ .coordinate = coordinate
197
+ };
198
+ mapViewEventEmitter->onDoublePress(data);
199
+ }
200
+ };
201
+
202
+ _view.onPanDrag = [self](NSDictionary* dictionary) {
203
+ if (_eventEmitter) {
204
+
205
+ NSDictionary* coordinateDict = dictionary[@"coordinate"];
206
+ NSDictionary* positionDict = dictionary[@"position"];
207
+
208
+ // Populate the OnMapPressCoordinate struct
209
+ facebook::react::RNMapsMapViewEventEmitter::OnPanDragCoordinate coordinate = {
210
+ .latitude = [coordinateDict[@"latitude"] doubleValue],
211
+ .longitude = [coordinateDict[@"longitude"] doubleValue],
212
+ };
213
+
214
+ // Populate the OnMapDouplePressPosition struct
215
+ facebook::react::RNMapsMapViewEventEmitter::OnPanDragPosition position = {
216
+ .x = [positionDict[@"x"] doubleValue],
217
+ .y = [positionDict[@"y"] doubleValue],
218
+ };
219
+
220
+ auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
221
+ facebook::react::RNMapsMapViewEventEmitter::OnPanDrag data = {
222
+ .position = position,
223
+ .coordinate = coordinate,
224
+ };
225
+ mapViewEventEmitter->onPanDrag(data);
226
+ }
227
+ };
323
228
 
229
+ _view.onUserLocationChange = [self](NSDictionary* dictionary) {
230
+ if (_eventEmitter) {
324
231
 
325
- #define HANDLE_MARKER_EVENT(eventName, emitterFunction, actionName) \
326
- if (_eventEmitter) { \
327
- NSDictionary* coordinateDict = dictionary[@"coordinate"]; \
328
- facebook::react::RNMapsMapViewEventEmitter::eventName##Coordinate coordinate = { \
329
- .latitude = [coordinateDict[@"latitude"] doubleValue], \
330
- .longitude = [coordinateDict[@"longitude"] doubleValue], \
331
- }; \
332
- \
333
- auto mapViewEventEmitter = \
334
- std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter); \
335
- facebook::react::RNMapsMapViewEventEmitter::eventName data = { \
336
- .action = std::string([@actionName UTF8String]), \
337
- .id = std::string([[dictionary valueForKey:@"id"] UTF8String]), \
338
- .coordinate = coordinate \
339
- }; \
340
- mapViewEventEmitter->emitterFunction(data); \
341
- }
232
+ NSDictionary* coordinateDict = dictionary[@"coordinate"];
233
+ NSDictionary* errorDict = dictionary[@"error"];
342
234
 
343
- _view.onMarkerDrag = [self](NSDictionary* dictionary) {
344
- HANDLE_MARKER_DRAG_EVENT(OnMarkerDrag, onMarkerDrag);
345
- };
346
235
 
347
- _view.onMarkerDragStart = [self](NSDictionary* dictionary) {
348
- HANDLE_MARKER_DRAG_EVENT(OnMarkerDragStart, onMarkerDragStart);
349
- };
236
+ // Populate the OnMapPressCoordinate struct
237
+ facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChangeCoordinate coordinate = {
238
+ .latitude = [coordinateDict[@"latitude"] doubleValue],
239
+ .longitude = [coordinateDict[@"longitude"] doubleValue],
240
+ };
241
+ NSString* str = @"";
242
+ if (errorDict){
243
+ str = errorDict[@"message"];
244
+ }
350
245
 
351
- _view.onMarkerDragEnd = [self](NSDictionary* dictionary) {
352
- HANDLE_MARKER_DRAG_EVENT(OnMarkerDragEnd, onMarkerDragEnd);
353
- };
246
+ facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChangeError error = {
247
+ .message = std::string([str UTF8String]),
248
+ };
354
249
 
355
- _view.onMarkerSelect = [self](NSDictionary* dictionary) {
356
- HANDLE_MARKER_EVENT(OnMarkerSelect, onMarkerSelect, "marker-select");
357
- };
358
250
 
359
- _view.onMarkerDeselect = [self](NSDictionary* dictionary) {
360
- HANDLE_MARKER_EVENT(OnMarkerDeselect, onMarkerDeselect, "marker-deselect");
361
- };
251
+ auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
252
+ facebook::react::RNMapsMapViewEventEmitter::OnUserLocationChange data = {
253
+ .coordinate = coordinate,
254
+ .error = error,
255
+ };
256
+ mapViewEventEmitter->onUserLocationChange(data);
257
+ }
258
+ };
259
+
260
+ _view.onCalloutPress = [self](NSDictionary* dictionary) {
261
+ if (_eventEmitter) {
262
+
263
+ NSDictionary* coordinateDict = dictionary[@"coordinate"];
264
+ NSDictionary* positionDict = dictionary[@"position"];
265
+
266
+ // Populate the OnCalloutPressPoint struct
267
+ facebook::react::RNMapsMapViewEventEmitter::OnCalloutPressPoint point = {
268
+ .x = [coordinateDict[@"x"] doubleValue],
269
+ .y = [coordinateDict[@"y"] doubleValue],
270
+ };
271
+
272
+
273
+ facebook::react::RNMapsMapViewEventEmitter::OnCalloutPressFrame frame = {
274
+ .x = [positionDict[@"x"] doubleValue],
275
+ .y = [positionDict[@"y"] doubleValue],
276
+ .width = [positionDict[@"width"] doubleValue],
277
+ .height = [positionDict[@"height"] doubleValue],
278
+ };
279
+
280
+ auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
281
+ facebook::react::RNMapsMapViewEventEmitter::OnCalloutPress data = {
282
+ .action = std::string([dictionary[@"action"] UTF8String]),
283
+ .id = std::string([dictionary[@"id"] UTF8String]),
284
+ .point = point,
285
+ .frame = frame,
286
+ };
287
+ mapViewEventEmitter->onCalloutPress(data);
288
+ }
289
+ };
290
+
291
+
292
+ _view.onRegionChangeStart = [self](NSDictionary* dictionary) {
293
+ if (_eventEmitter) {
294
+
295
+ NSDictionary* regionDict = dictionary[@"region"];
296
+ auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
297
+ facebook::react::RNMapsMapViewEventEmitter::OnRegionChangeStart data = {
298
+ .region.latitude = [regionDict[@"latitude"] doubleValue],
299
+ .region.longitude = [regionDict[@"longitude"] doubleValue],
300
+ .region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
301
+ .region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
302
+ .continuous = [dictionary[@"continuous"] boolValue],
303
+ };
304
+ mapViewEventEmitter->onRegionChangeStart(data);
305
+ }
306
+ };
362
307
 
363
- _view.onMarkerPress = [self](NSDictionary* dictionary) {
364
- HANDLE_MARKER_EVENT(OnMarkerPress, onMarkerPress, "marker-press");
365
- };
366
308
 
309
+ #define HANDLE_MARKER_DRAG_EVENT(eventName, emitterFunction) \
310
+ if (_eventEmitter) { \
311
+ NSDictionary* coordinateDict = dictionary[@"coordinate"]; \
312
+ auto mapViewEventEmitter = \
313
+ std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter); \
314
+ facebook::react::RNMapsMapViewEventEmitter::eventName data = { \
315
+ .coordinate.latitude = [coordinateDict[@"latitude"] doubleValue], \
316
+ .coordinate.longitude = [coordinateDict[@"longitude"] doubleValue], \
317
+ .id = std::string([[dictionary valueForKey:@"id"] UTF8String]), \
318
+ }; \
319
+ mapViewEventEmitter->emitterFunction(data); \
320
+ }
367
321
 
368
322
 
369
- }
370
323
 
371
- return self;
324
+ #define HANDLE_MARKER_EVENT(eventName, emitterFunction, actionName) \
325
+ if (_eventEmitter) { \
326
+ NSDictionary* coordinateDict = dictionary[@"coordinate"]; \
327
+ facebook::react::RNMapsMapViewEventEmitter::eventName##Coordinate coordinate = { \
328
+ .latitude = [coordinateDict[@"latitude"] doubleValue], \
329
+ .longitude = [coordinateDict[@"longitude"] doubleValue], \
330
+ }; \
331
+ \
332
+ auto mapViewEventEmitter = \
333
+ std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter); \
334
+ facebook::react::RNMapsMapViewEventEmitter::eventName data = { \
335
+ .action = std::string([@actionName UTF8String]), \
336
+ .id = std::string([[dictionary valueForKey:@"id"] UTF8String]), \
337
+ .coordinate = coordinate \
338
+ }; \
339
+ mapViewEventEmitter->emitterFunction(data); \
372
340
  }
373
341
 
374
- - (id)getPaperViewFromChildComponentView:(UIView *)childComponentView {
375
- // Check if the childComponentView responds to the "adapter" selector
376
- if ([childComponentView respondsToSelector:@selector(paperView)]) {
377
- // Safely return the paperView
378
- return [childComponentView valueForKey:@"paperView"];
342
+ _view.onMarkerDrag = [self](NSDictionary* dictionary) {
343
+ HANDLE_MARKER_DRAG_EVENT(OnMarkerDrag, onMarkerDrag);
344
+ };
345
+
346
+ _view.onMarkerDragStart = [self](NSDictionary* dictionary) {
347
+ HANDLE_MARKER_DRAG_EVENT(OnMarkerDragStart, onMarkerDragStart);
348
+ };
349
+
350
+ _view.onMarkerDragEnd = [self](NSDictionary* dictionary) {
351
+ HANDLE_MARKER_DRAG_EVENT(OnMarkerDragEnd, onMarkerDragEnd);
352
+ };
353
+
354
+ _view.onMarkerSelect = [self](NSDictionary* dictionary) {
355
+ HANDLE_MARKER_EVENT(OnMarkerSelect, onMarkerSelect, "marker-select");
356
+ };
357
+
358
+ _view.onMarkerDeselect = [self](NSDictionary* dictionary) {
359
+ HANDLE_MARKER_EVENT(OnMarkerDeselect, onMarkerDeselect, "marker-deselect");
360
+ };
361
+
362
+ _view.onMarkerPress = [self](NSDictionary* dictionary) {
363
+ HANDLE_MARKER_EVENT(OnMarkerPress, onMarkerPress, "marker-press");
364
+ };
365
+ }
366
+ - (instancetype)initWithFrame:(CGRect)frame
367
+ {
368
+ if (self = [super initWithFrame:frame]) {
369
+ [self prepareMapView];
379
370
  }
380
- // Return nil if paperView is not accessible
381
- return nil;
371
+
372
+ return self;
382
373
  }
383
374
 
375
+
384
376
  - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index{
385
- id<RCTComponent> paperView = [self getPaperViewFromChildComponentView:childComponentView];
377
+ id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
386
378
  if (paperView){
387
379
  [_view insertReactSubview:paperView atIndex:index];
380
+ } else if ([childComponentView isKindOfClass:[RNMapsMarkerView class]]){
381
+ RNMapsMarkerView* fabricMarker = (RNMapsMarkerView *) childComponentView;
382
+ [_view insertReactSubview:[fabricMarker marker] atIndex:index];
383
+ }
384
+ else {
385
+ [_view insertReactSubview:childComponentView atIndex:index];
388
386
  }
389
387
  }
388
+
390
389
  - (void) unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
391
390
  {
392
- id<RCTComponent> paperView = [self getPaperViewFromChildComponentView:childComponentView];
391
+ id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
393
392
  if (paperView){
394
393
  [_view removeReactSubview:paperView];
395
394
  }
395
+ else if ([childComponentView isKindOfClass:[RNMapsMarkerView class]]){
396
+ RNMapsMarkerView* fabricMarker = (RNMapsMarkerView *) childComponentView;
397
+ [_view removeReactSubview:[fabricMarker marker]];
398
+ } else {
399
+ [_view removeReactSubview:childComponentView];
400
+ }
396
401
  }
397
402
 
398
403
  MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
@@ -410,67 +415,76 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
410
415
 
411
416
  - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
412
417
  {
413
- const auto &oldViewProps = *std::static_pointer_cast<RNMapsMapViewProps const>(_props);
414
- const auto &newViewProps = *std::static_pointer_cast<RNMapsMapViewProps const>(props);
418
+ [self prepareMapView];
419
+ const auto &oldViewProps = *std::static_pointer_cast<RNMapsMapViewProps const>(_props);
420
+ const auto &newViewProps = *std::static_pointer_cast<RNMapsMapViewProps const>(props);
415
421
 
416
422
  #define REMAP_MAPVIEW_PROP(name) \
417
- if (oldViewProps.name != newViewProps.name) { \
418
- _view.name = newViewProps.name; \
419
- }
423
+ if (oldViewProps.name != newViewProps.name) { \
424
+ _view.name = newViewProps.name; \
425
+ }
420
426
 
421
427
  #define REMAP_MAPVIEW_STRING_PROP(name) \
422
- if (oldViewProps.name != newViewProps.name) { \
423
- _view.name = RCTNSStringFromString(newViewProps.name); \
424
- }
428
+ if (oldViewProps.name != newViewProps.name) { \
429
+ _view.name = RCTNSStringFromString(newViewProps.name); \
430
+ }
425
431
 
426
432
  #define REMAP_MAPVIEW_COLOR_PROP(name) \
427
- if (oldViewProps.name != newViewProps.name) { \
428
- _view.name = RCTUIColorFromSharedColor(newViewProps.name); \
429
- }
433
+ if (oldViewProps.name != newViewProps.name) { \
434
+ _view.name = RCTUIColorFromSharedColor(newViewProps.name); \
435
+ }
430
436
 
431
437
  #define REMAP_MAPVIEW_POINT_PROP(name) \
432
- if (newViewProps.name.x != oldViewProps.name.x || \
433
- newViewProps.name.y != oldViewProps.name.y) { \
434
- _view.name = CGPointMake(newViewProps.name.x, newViewProps.name.y); \
435
- }
438
+ if (newViewProps.name.x != oldViewProps.name.x || \
439
+ newViewProps.name.y != oldViewProps.name.y) { \
440
+ _view.name = CGPointMake(newViewProps.name.x, newViewProps.name.y); \
441
+ }
436
442
 
437
443
  #define REMAP_MAPVIEW_REGION_PROP(name) \
438
- if (newViewProps.name.latitude != oldViewProps.name.latitude || \
439
- newViewProps.name.longitude != oldViewProps.name.longitude || \
444
+ if (!(newViewProps.name.latitude == 0 && \
445
+ newViewProps.name.longitude == 0 && \
446
+ newViewProps.name.latitudeDelta == 0 && \
447
+ newViewProps.name.longitudeDelta == 0)) { \
448
+ if (newViewProps.name.latitude != oldViewProps.name.latitude || \
449
+ newViewProps.name.longitude != oldViewProps.name.longitude || \
440
450
  newViewProps.name.latitudeDelta != oldViewProps.name.latitudeDelta ||\
441
451
  newViewProps.name.longitudeDelta != oldViewProps.name.longitudeDelta) { \
442
452
  MKCoordinateSpan span = MKCoordinateSpanMake(newViewProps.name.latitudeDelta, \
443
453
  newViewProps.name.longitudeDelta); \
444
454
  MKCoordinateRegion region = MKCoordinateRegionMake(CLLocationCoordinate2DMake( \
445
- newViewProps.name.latitude, newViewProps.name.longitude), span); \
455
+ newViewProps.name.latitude, \
456
+ newViewProps.name.longitude), span); \
446
457
  _view.name = region; \
447
- }
458
+ } \
459
+ }
460
+
448
461
 
449
462
  #define REMAP_MAPVIEW_CAMERA_PROP(name) \
450
- if (newViewProps.name.center.latitude != oldViewProps.name.center.latitude || \
451
- newViewProps.name.center.longitude != oldViewProps.name.center.longitude || \
452
- newViewProps.name.heading != oldViewProps.name.heading || \
453
- newViewProps.name.pitch != oldViewProps.name.pitch) { \
454
- CLLocationCoordinate2D center = CLLocationCoordinate2DMake( \
455
- newViewProps.name.center.latitude, \
456
- newViewProps.name.center.longitude); \
457
- MKMapCamera* camera = [[MKMapCamera alloc] init]; \
458
- camera.centerCoordinate = center; \
459
- camera.heading = newViewProps.name.heading; \
460
- camera.pitch = newViewProps.name.pitch; \
461
- _view.name = camera; \
462
- }
463
+ if (newViewProps.name.center.latitude != oldViewProps.name.center.latitude || \
464
+ newViewProps.name.center.longitude != oldViewProps.name.center.longitude || \
465
+ newViewProps.name.heading != oldViewProps.name.heading || \
466
+ newViewProps.name.pitch != oldViewProps.name.pitch) { \
467
+ CLLocationCoordinate2D center = CLLocationCoordinate2DMake( \
468
+ newViewProps.name.center.latitude, \
469
+ newViewProps.name.center.longitude); \
470
+ MKMapCamera* camera = [[MKMapCamera alloc] init]; \
471
+ camera.centerCoordinate = center; \
472
+ camera.heading = newViewProps.name.heading; \
473
+ camera.pitch = newViewProps.name.pitch; \
474
+ camera.centerCoordinateDistance = newViewProps.name.altitude; \
475
+ _view.name = camera; \
476
+ }
463
477
 
464
478
  #define REMAP_MAPVIEW_EDGEINSETS_PROP(name) \
465
- if (newViewProps.name.top != oldViewProps.name.top || \
466
- newViewProps.name.right != oldViewProps.name.right || \
467
- newViewProps.name.bottom != oldViewProps.name.bottom || \
468
- newViewProps.name.left != oldViewProps.name.left) { \
469
- _view.name = UIEdgeInsetsMake(newViewProps.name.top, \
470
- newViewProps.name.left, \
471
- newViewProps.name.bottom, \
472
- newViewProps.name.right); \
473
- }
479
+ if (newViewProps.name.top != oldViewProps.name.top || \
480
+ newViewProps.name.right != oldViewProps.name.right || \
481
+ newViewProps.name.bottom != oldViewProps.name.bottom || \
482
+ newViewProps.name.left != oldViewProps.name.left) { \
483
+ _view.name = UIEdgeInsetsMake(newViewProps.name.top, \
484
+ newViewProps.name.left, \
485
+ newViewProps.name.bottom, \
486
+ newViewProps.name.right); \
487
+ }
474
488
 
475
489
  #define REMAP_MAPVIEW_MAPTYPE(rnMapType) MKMapType##rnMapType
476
490
 
@@ -479,24 +493,30 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
479
493
 
480
494
  REMAP_MAPVIEW_PROP(followsUserLocation)
481
495
  REMAP_MAPVIEW_PROP(loadingEnabled)
496
+
482
497
  REMAP_MAPVIEW_PROP(scrollEnabled)
498
+ REMAP_MAPVIEW_PROP(handlePanDrag)
483
499
 
484
500
  REMAP_MAPVIEW_PROP(maxDelta)
485
- REMAP_MAPVIEW_PROP(maxZoomLevel)
501
+ REMAP_MAPVIEW_PROP(maxZoom)
486
502
  REMAP_MAPVIEW_PROP(minDelta)
487
- REMAP_MAPVIEW_PROP(minZoomLevel)
503
+ REMAP_MAPVIEW_PROP(minZoom)
488
504
 
489
505
  REMAP_MAPVIEW_PROP(showsCompass)
490
506
  REMAP_MAPVIEW_PROP(showsScale)
491
- REMAP_MAPVIEW_PROP(showsTraffic)
492
507
  REMAP_MAPVIEW_PROP(showsUserLocation)
493
508
  REMAP_MAPVIEW_PROP(userLocationCalloutEnabled)
494
509
  REMAP_MAPVIEW_PROP(zoomEnabled)
495
510
 
511
+
496
512
  REMAP_MAPVIEW_POINT_PROP(compassOffset)
497
513
 
498
- REMAP_MAPVIEW_REGION_PROP(region)
499
- REMAP_MAPVIEW_REGION_PROP(initialRegion)
514
+ if (![_view ignoreRegionChanges]){
515
+ _view.ignoreRegionChanges = YES;
516
+ REMAP_MAPVIEW_REGION_PROP(initialRegion)
517
+ REMAP_MAPVIEW_REGION_PROP(region)
518
+ _view.ignoreRegionChanges = NO;
519
+ }
500
520
 
501
521
  REMAP_MAPVIEW_CAMERA_PROP(initialCamera)
502
522
  REMAP_MAPVIEW_CAMERA_PROP(camera)
@@ -508,7 +528,6 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
508
528
  REMAP_MAPVIEW_COLOR_PROP(loadingIndicatorColor)
509
529
  REMAP_MAPVIEW_COLOR_PROP(tintColor)
510
530
 
511
- // userLocationAnnotationTitle
512
531
  REMAP_MAPVIEW_STRING_PROP(userLocationAnnotationTitle)
513
532
 
514
533
  if (oldViewProps.mapType != newViewProps.mapType){
@@ -537,12 +556,12 @@ MKMapType mapRNTypeToMKMapType(RNMapsMapViewMapType rnMapType) {
537
556
  }
538
557
 
539
558
 
540
- [super updateProps:props oldProps:oldProps];
559
+ [super updateProps:props oldProps:oldProps];
541
560
  }
542
561
 
543
562
  @end
544
563
 
545
564
  Class<RCTComponentViewProtocol> RNMapsMapViewCls(void)
546
565
  {
547
- return RNMapsMapView.class;
566
+ return RNMapsMapView.class;
548
567
  }