react-native-maps 1.7.1 → 2.0.0-beta.10

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 (186) hide show
  1. package/README.md +34 -11
  2. package/android/build.gradle +41 -10
  3. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  4. package/android/src/main/java/com/rnmaps/maps/MapCalloutManager.java +1 -1
  5. package/android/src/main/java/com/rnmaps/maps/MapCircleManager.java +1 -1
  6. package/android/src/main/java/com/rnmaps/maps/MapGradientPolyline.java +4 -4
  7. package/android/src/main/java/com/rnmaps/maps/MapGradientPolylineManager.java +1 -1
  8. package/android/src/main/java/com/rnmaps/maps/MapHeatmapManager.java +1 -1
  9. package/android/src/main/java/com/rnmaps/maps/MapLiteManager.java +1 -1
  10. package/android/src/main/java/com/rnmaps/maps/MapLocalTile.java +4 -4
  11. package/android/src/main/java/com/rnmaps/maps/MapLocalTileManager.java +1 -1
  12. package/android/src/main/java/com/rnmaps/maps/MapManager.java +6 -63
  13. package/android/src/main/java/com/rnmaps/maps/MapMarker.java +2 -2
  14. package/android/src/main/java/com/rnmaps/maps/MapMarkerManager.java +10 -27
  15. package/android/src/main/java/com/rnmaps/maps/MapOverlayManager.java +1 -1
  16. package/android/src/main/java/com/rnmaps/maps/MapPolygonManager.java +1 -1
  17. package/android/src/main/java/com/rnmaps/maps/MapPolylineManager.java +1 -1
  18. package/android/src/main/java/com/rnmaps/maps/MapTileProvider.java +7 -5
  19. package/android/src/main/java/com/rnmaps/maps/MapUrlTileManager.java +1 -1
  20. package/android/src/main/java/com/rnmaps/maps/MapView.java +60 -149
  21. package/android/src/main/java/com/rnmaps/maps/MapViewModule.java +598 -0
  22. package/android/src/main/java/com/rnmaps/maps/MapWMSTile.java +6 -6
  23. package/android/src/main/java/com/rnmaps/maps/MapWMSTileManager.java +1 -1
  24. package/android/src/main/java/com/rnmaps/maps/MapsPackage.java +1 -1
  25. package/android/src/main/java/com/rnmaps/maps/SizeReportingShadowNode.java +1 -1
  26. package/ios/{AirGoogleMaps → GoogleMaps}/RCTConvert+GMSMapViewType.m +8 -0
  27. package/ios/{AirGoogleMaps/AIRDummyView.h → GoogleMaps/RNMDummyView.h} +3 -3
  28. package/ios/{AirGoogleMaps/AIRDummyView.m → GoogleMaps/RNMDummyView.m} +4 -4
  29. package/ios/{AirGoogleMaps/AIRGMSMarker.h → GoogleMaps/RNMGMSMarker.h} +6 -6
  30. package/ios/{AirGoogleMaps/AIRGMSMarker.m → GoogleMaps/RNMGMSMarker.m} +4 -4
  31. package/ios/{AirGoogleMaps/AIRGMSPolygon.h → GoogleMaps/RNMGMSPolygon.h} +4 -4
  32. package/ios/{AirGoogleMaps/AIRGMSPolygon.m → GoogleMaps/RNMGMSPolygon.m} +4 -4
  33. package/ios/{AirGoogleMaps/AIRGMSPolyline.h → GoogleMaps/RNMGMSPolyline.h} +4 -4
  34. package/ios/{AirGoogleMaps/AIRGMSPolyline.m → GoogleMaps/RNMGMSPolyline.m} +4 -4
  35. package/ios/{AirGoogleMaps/AIRGoogleMap.h → GoogleMaps/RNMGoogleMap.h} +5 -5
  36. package/ios/{AirGoogleMaps/AIRGoogleMap.m → GoogleMaps/RNMGoogleMap.m} +81 -77
  37. package/ios/{AirGoogleMaps/AIRGoogleMapCallout.h → GoogleMaps/RNMGoogleMapCallout.h} +3 -3
  38. package/ios/{AirGoogleMaps/AIRGoogleMapCallout.m → GoogleMaps/RNMGoogleMapCallout.m} +4 -4
  39. package/ios/{AirGoogleMaps/AIRGoogleMapCalloutManager.h → GoogleMaps/RNMGoogleMapCalloutManager.h} +3 -3
  40. package/ios/{AirGoogleMaps/AIRGoogleMapCalloutManager.m → GoogleMaps/RNMGoogleMapCalloutManager.m} +7 -7
  41. package/ios/{AirGoogleMaps/AIRGoogleMapCalloutSubview.h → GoogleMaps/RNMGoogleMapCalloutSubview.h} +3 -3
  42. package/ios/{AirGoogleMaps/AIRGoogleMapCalloutSubview.m → GoogleMaps/RNMGoogleMapCalloutSubview.m} +4 -4
  43. package/ios/{AirGoogleMaps/AIRGoogleMapCalloutSubviewManager.h → GoogleMaps/RNMGoogleMapCalloutSubviewManager.h} +3 -3
  44. package/ios/GoogleMaps/RNMGoogleMapCalloutSubviewManager.m +28 -0
  45. package/ios/{AirGoogleMaps/AIRGoogleMapCircle.h → GoogleMaps/RNMGoogleMapCircle.h} +3 -3
  46. package/ios/{AirGoogleMaps/AIRGoogleMapCircle.m → GoogleMaps/RNMGoogleMapCircle.m} +3 -3
  47. package/ios/{AirGoogleMaps/AIRGoogleMapCircleManager.h → GoogleMaps/RNMGoogleMapCircleManager.h} +2 -2
  48. package/ios/{AirGoogleMaps/AIRGoogleMapCircleManager.m → GoogleMaps/RNMGoogleMapCircleManager.m} +7 -7
  49. package/ios/{AirGoogleMaps/AIRGoogleMapHeatmap.h → GoogleMaps/RNMGoogleMapHeatmap.h} +3 -3
  50. package/ios/{AirGoogleMaps/AIRGoogleMapHeatmap.m → GoogleMaps/RNMGoogleMapHeatmap.m} +4 -4
  51. package/ios/GoogleMaps/RNMGoogleMapHeatmapManager.h +11 -0
  52. package/ios/{AirGoogleMaps/AIRGoogleMapHeatmapManager.m → GoogleMaps/RNMGoogleMapHeatmapManager.m} +9 -9
  53. package/ios/{AirGoogleMaps/AIRGoogleMapManager.h → GoogleMaps/RNMGoogleMapManager.h} +3 -3
  54. package/ios/GoogleMaps/RNMGoogleMapManager.m +256 -0
  55. package/ios/{AirGoogleMaps/AIRGoogleMapMarker.h → GoogleMaps/RNMGoogleMapMarker.h} +15 -15
  56. package/ios/{AirGoogleMaps/AIRGoogleMapMarker.m → GoogleMaps/RNMGoogleMapMarker.m} +23 -23
  57. package/ios/{AirGoogleMaps/AIRGoogleMapMarkerManager.h → GoogleMaps/RNMGoogleMapMarkerManager.h} +3 -3
  58. package/ios/{AirGoogleMaps/AIRGoogleMapMarkerManager.m → GoogleMaps/RNMGoogleMapMarkerManager.m} +20 -20
  59. package/ios/{AirGoogleMaps/AIRGoogleMapOverlay.h → GoogleMaps/RNMGoogleMapOverlay.h} +4 -4
  60. package/ios/{AirGoogleMaps/AIRGoogleMapOverlay.m → GoogleMaps/RNMGoogleMapOverlay.m} +4 -4
  61. package/ios/{AirGoogleMaps/AIRGoogleMapOverlayManager.h → GoogleMaps/RNMGoogleMapOverlayManager.h} +2 -2
  62. package/ios/{AirGoogleMaps/AIRGoogleMapOverlayManager.m → GoogleMaps/RNMGoogleMapOverlayManager.m} +6 -6
  63. package/ios/{AirGoogleMaps/AIRGoogleMapPolygon.h → GoogleMaps/RNMGoogleMapPolygon.h} +7 -7
  64. package/ios/{AirGoogleMaps/AIRGoogleMapPolygon.m → GoogleMaps/RNMGoogleMapPolygon.m} +7 -7
  65. package/ios/{AirGoogleMaps/AIRGoogleMapPolylineManager.h → GoogleMaps/RNMGoogleMapPolygonManager.h} +2 -2
  66. package/ios/{AirGoogleMaps/AIRGoogleMapPolygonManager.m → GoogleMaps/RNMGoogleMapPolygonManager.m} +10 -10
  67. package/ios/{AirGoogleMaps/AIRGoogleMapPolyline.h → GoogleMaps/RNMGoogleMapPolyline.h} +7 -7
  68. package/ios/{AirGoogleMaps/AIRGoogleMapPolyline.m → GoogleMaps/RNMGoogleMapPolyline.m} +9 -9
  69. package/ios/{AirGoogleMaps/AIRGoogleMapPolygonManager.h → GoogleMaps/RNMGoogleMapPolylineManager.h} +2 -2
  70. package/ios/{AirGoogleMaps/AIRGoogleMapPolylineManager.m → GoogleMaps/RNMGoogleMapPolylineManager.m} +9 -9
  71. package/ios/{AirGoogleMaps/AIRGoogleMapUrlTile.h → GoogleMaps/RNMGoogleMapUrlTile.h} +2 -2
  72. package/ios/{AirGoogleMaps/AIRGoogleMapUrlTile.m → GoogleMaps/RNMGoogleMapUrlTile.m} +3 -3
  73. package/ios/{AirGoogleMaps/AIRGoogleMapUrlTileManager.h → GoogleMaps/RNMGoogleMapUrlTileManager.h} +2 -2
  74. package/ios/{AirGoogleMaps/AIRGoogleMapURLTileManager.m → GoogleMaps/RNMGoogleMapUrlTileManager.m} +7 -7
  75. package/ios/GoogleMaps/RNMGoogleMapViewModule.h +5 -0
  76. package/ios/GoogleMaps/RNMGoogleMapViewModule.m +380 -0
  77. package/ios/{AirGoogleMaps/AIRGoogleMapWMSTile.h → GoogleMaps/RNMGoogleMapWMSTile.h} +3 -3
  78. package/ios/{AirGoogleMaps/AIRGoogleMapWMSTile.m → GoogleMaps/RNMGoogleMapWMSTile.m} +4 -4
  79. package/ios/{AirGoogleMaps/AIRGoogleMapWMSTileManager.h → GoogleMaps/RNMGoogleMapWMSTileManager.h} +3 -3
  80. package/ios/{AirGoogleMaps/AIRGoogleMapWMSTileManager.m → GoogleMaps/RNMGoogleMapWMSTileManager.m} +8 -8
  81. package/ios/{AirMaps → Maps}/Callout/SMCalloutView.h +9 -8
  82. package/ios/{AirMaps → Maps}/Callout/SMCalloutView.m +118 -118
  83. package/ios/{AirMaps/RCTConvert+AirMap.h → Maps/RCTConvert+RNMMap.h} +1 -1
  84. package/ios/{AirMaps/RCTConvert+AirMap.m → Maps/RCTConvert+RNMMap.m} +25 -8
  85. package/ios/{AirMaps/AIRMap.h → Maps/RNMMap.h} +8 -8
  86. package/ios/{AirMaps/AIRMap.m → Maps/RNMMap.m} +60 -56
  87. package/ios/{AirMaps/AIRMapCallout.h → Maps/RNMMapCallout.h} +1 -1
  88. package/ios/{AirMaps/AIRMapCallout.m → Maps/RNMMapCallout.m} +2 -2
  89. package/ios/{AirMaps/AIRMapCircleManager.h → Maps/RNMMapCalloutManager.h} +2 -2
  90. package/ios/{AirMaps/AIRMapCalloutManager.m → Maps/RNMMapCalloutManager.m} +7 -7
  91. package/ios/{AirMaps/AIRMapCalloutSubview.h → Maps/RNMMapCalloutSubview.h} +3 -3
  92. package/ios/{AirMaps/AIRMapCalloutSubview.m → Maps/RNMMapCalloutSubview.m} +4 -4
  93. package/ios/Maps/RNMMapCalloutSubviewManager.h +14 -0
  94. package/ios/Maps/RNMMapCalloutSubviewManager.m +24 -0
  95. package/ios/{AirMaps/AIRMapCircle.h → Maps/RNMMapCircle.h} +5 -5
  96. package/ios/{AirMaps/AIRMapCircle.m → Maps/RNMMapCircle.m} +3 -3
  97. package/ios/{AirMaps/AIRMapCalloutManager.h → Maps/RNMMapCircleManager.h} +2 -2
  98. package/ios/{AirMaps/AIRMapCircleManager.m → Maps/RNMMapCircleManager.m} +7 -7
  99. package/ios/{AirMaps/AIRMapCoordinate.h → Maps/RNMMapCoordinate.h} +2 -2
  100. package/ios/{AirMaps/AIRMapCoordinate.m → Maps/RNMMapCoordinate.m} +3 -3
  101. package/ios/{AirMaps/AIRMapLocalTile.h → Maps/RNMMapLocalTile.h} +7 -7
  102. package/ios/{AirMaps/AIRMapLocalTile.m → Maps/RNMMapLocalTile.m} +6 -6
  103. package/ios/{AirMaps/AIRMapLocalTileManager.h → Maps/RNMMapLocalTileManager.h} +3 -3
  104. package/ios/{AirMaps/AIRMapLocalTileManager.m → Maps/RNMMapLocalTileManager.m} +9 -9
  105. package/ios/{AirMaps/AIRMapLocalTileOverlay.h → Maps/RNMMapLocalTileOverlay.h} +2 -2
  106. package/ios/{AirMaps/AIRMapLocalTileOverlay.m → Maps/RNMMapLocalTileOverlay.m} +5 -5
  107. package/ios/{AirMaps/AIRMapManager.h → Maps/RNMMapManager.h} +6 -6
  108. package/ios/Maps/RNMMapManager.m +854 -0
  109. package/ios/{AirMaps/AIRMapMarker.h → Maps/RNMMapMarker.h} +8 -8
  110. package/ios/{AirMaps/AIRMapMarker.m → Maps/RNMMapMarker.m} +22 -25
  111. package/ios/{AirMaps/AIRMapMarkerManager.h → Maps/RNMMapMarkerManager.h} +1 -1
  112. package/ios/{AirMaps/AIRMapMarkerManager.m → Maps/RNMMapMarkerManager.m} +14 -14
  113. package/ios/{AirMaps/AIRMapOverlay.h → Maps/RNMMapOverlay.h} +7 -7
  114. package/ios/{AirMaps/AIRMapOverlay.m → Maps/RNMMapOverlay.m} +4 -4
  115. package/ios/Maps/RNMMapOverlayManager.h +5 -0
  116. package/ios/{AirMaps/AIRMapOverlayManager.m → Maps/RNMMapOverlayManager.m} +6 -6
  117. package/ios/{AirMaps/AIRMapOverlayRenderer.h → Maps/RNMMapOverlayRenderer.h} +1 -1
  118. package/ios/{AirMaps/AIRMapOverlayRenderer.m → Maps/RNMMapOverlayRenderer.m} +5 -5
  119. package/ios/{AirMaps/AIRMapPolygon.h → Maps/RNMMapPolygon.h} +7 -7
  120. package/ios/{AirMaps/AIRMapPolygon.m → Maps/RNMMapPolygon.m} +4 -4
  121. package/ios/{AirMaps/AIRMapPolygonManager.h → Maps/RNMMapPolygonManager.h} +2 -2
  122. package/ios/{AirMaps/AIRMapPolygonManager.m → Maps/RNMMapPolygonManager.m} +10 -10
  123. package/ios/{AirMaps/AIRMapPolyline.h → Maps/RNMMapPolyline.h} +6 -6
  124. package/ios/{AirMaps/AIRMapPolyline.m → Maps/RNMMapPolyline.m} +11 -11
  125. package/ios/{AirMaps/AIRMapPolylineManager.h → Maps/RNMMapPolylineManager.h} +2 -2
  126. package/ios/{AirMaps/AIRMapPolylineManager.m → Maps/RNMMapPolylineManager.m} +9 -9
  127. package/ios/{AirMaps/AIRMapPolylineRenderer.h → Maps/RNMMapPolylineRenderer.h} +2 -2
  128. package/ios/{AirMaps/AIRMapPolylineRenderer.m → Maps/RNMMapPolylineRenderer.m} +10 -10
  129. package/ios/{AirMaps/AIRMapSnapshot.h → Maps/RNMMapSnapshot.h} +6 -6
  130. package/ios/{AirMaps/AIRMapUrlTile.h → Maps/RNMMapUrlTile.h} +18 -18
  131. package/ios/{AirMaps/AIRMapUrlTile.m → Maps/RNMMapUrlTile.m} +7 -7
  132. package/ios/{AirMaps/AIRMapUrlTileCachedOverlay.h → Maps/RNMMapUrlTileCachedOverlay.h} +3 -3
  133. package/ios/{AirMaps/AIRMapUrlTileCachedOverlay.m → Maps/RNMMapUrlTileCachedOverlay.m} +10 -10
  134. package/ios/{AirMaps/AIRMapUrlTileManager.h → Maps/RNMMapUrlTileManager.h} +3 -3
  135. package/ios/{AirMaps/AIRMapUrlTileManager.m → Maps/RNMMapUrlTileManager.m} +9 -9
  136. package/ios/Maps/RNMMapViewModule.h +5 -0
  137. package/ios/Maps/RNMMapViewModule.m +459 -0
  138. package/ios/{AirMaps/AIRMapWMSTile.h → Maps/RNMMapWMSTile.h} +11 -11
  139. package/ios/{AirMaps/AIRMapWMSTile.m → Maps/RNMMapWMSTile.m} +15 -15
  140. package/ios/{AirMaps/AIRMapWMSTileManager.h → Maps/RNMMapWMSTileManager.h} +3 -3
  141. package/ios/{AirMaps/AIRMapWMSTileManager.m → Maps/RNMMapWMSTileManager.m} +9 -9
  142. package/ios/RNMaps.xcodeproj/project.pbxproj +647 -0
  143. package/lib/Geojson.d.ts +1 -1
  144. package/lib/MapCallout.js +2 -2
  145. package/lib/MapCalloutSubview.js +2 -2
  146. package/lib/MapCircle.js +2 -2
  147. package/lib/MapHeatmap.js +2 -2
  148. package/lib/MapLocalTile.js +2 -2
  149. package/lib/MapMarker.d.ts +2 -3
  150. package/lib/MapMarker.js +2 -4
  151. package/lib/MapOverlay.d.ts +1 -2
  152. package/lib/MapOverlay.js +2 -4
  153. package/lib/MapPolygon.js +2 -2
  154. package/lib/MapPolyline.js +2 -2
  155. package/lib/MapUrlTile.js +2 -2
  156. package/lib/MapView.d.ts +14 -14
  157. package/lib/MapView.js +92 -107
  158. package/lib/MapView.types.d.ts +8 -3
  159. package/lib/MapViewNativeComponent.d.ts +1 -8
  160. package/lib/MapViewNativeComponent.js +1 -10
  161. package/lib/MapWMSTile.js +2 -2
  162. package/lib/NativeGoogleMapViewModule.d.ts +25 -0
  163. package/lib/NativeGoogleMapViewModule.js +4 -0
  164. package/lib/NativeMapViewModule.d.ts +29 -0
  165. package/lib/NativeMapViewModule.js +4 -0
  166. package/lib/decorateMapComponent.d.ts +1 -1
  167. package/lib/decorateMapComponent.js +3 -3
  168. package/lib/index.d.ts +14 -21
  169. package/lib/index.js +10 -38
  170. package/package.json +6 -6
  171. package/react-native-google-maps.podspec +1 -1
  172. package/react-native-maps.podspec +2 -2
  173. package/android/src/main/java/com/rnmaps/maps/MapModule.java +0 -380
  174. package/ios/AirGoogleMaps/AIRGoogleMapCalloutSubviewManager.m +0 -28
  175. package/ios/AirGoogleMaps/AIRGoogleMapHeatmapManager.h +0 -11
  176. package/ios/AirGoogleMaps/AIRGoogleMapManager.m +0 -597
  177. package/ios/AirMaps/AIRMapCalloutSubviewManager.h +0 -14
  178. package/ios/AirMaps/AIRMapCalloutSubviewManager.m +0 -24
  179. package/ios/AirMaps/AIRMapManager.m +0 -1253
  180. package/ios/AirMaps/AIRMapOverlayManager.h +0 -5
  181. package/ios/AirMaps/AIRWeakMapReference.h +0 -24
  182. package/ios/AirMaps/AIRWeakMapReference.m +0 -23
  183. package/ios/AirMaps/AIRWeakTimerReference.h +0 -21
  184. package/ios/AirMaps/AIRWeakTimerReference.m +0 -42
  185. package/ios/AirMaps.xcodeproj/project.pbxproj +0 -587
  186. /package/ios/{AirGoogleMaps → GoogleMaps}/RCTConvert+GMSMapViewType.h +0 -0
@@ -98,7 +98,11 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
98
98
  self.titleLabel.opaque = NO;
99
99
  self.titleLabel.backgroundColor = [UIColor clearColor];
100
100
  self.titleLabel.font = [UIFont systemFontOfSize:17];
101
- self.titleLabel.textColor = [UIColor blackColor];
101
+ if (@available(iOS 13.0, *)) {
102
+ self.titleLabel.textColor = [UIColor labelColor];
103
+ } else {
104
+ self.titleLabel.textColor = [UIColor blackColor];
105
+ }
102
106
  }
103
107
  return self.titleLabel;
104
108
  }
@@ -116,7 +120,11 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
116
120
  self.subtitleLabel.opaque = NO;
117
121
  self.subtitleLabel.backgroundColor = [UIColor clearColor];
118
122
  self.subtitleLabel.font = [UIFont systemFontOfSize:12];
119
- self.subtitleLabel.textColor = [UIColor blackColor];
123
+ if (@available(iOS 13.0, *)) {
124
+ self.subtitleLabel.textColor = [UIColor secondaryLabelColor];
125
+ } else {
126
+ self.subtitleLabel.textColor = [UIColor blackColor];
127
+ }
120
128
  }
121
129
  return self.subtitleLabel;
122
130
  }
@@ -156,24 +164,24 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
156
164
 
157
165
  - (CGFloat)leftAccessoryVerticalMargin {
158
166
  if (self.leftAccessoryView.frameHeight < self.calloutContainerHeight)
159
- return roundf((self.calloutContainerHeight - self.leftAccessoryView.frameHeight) / 2);
167
+ return round((self.calloutContainerHeight - self.leftAccessoryView.frameHeight) / 2);
160
168
  else
161
169
  return 0;
162
170
  }
163
171
 
164
172
  - (CGFloat)leftAccessoryHorizontalMargin {
165
- return fminf(self.leftAccessoryVerticalMargin, TITLE_HMARGIN);
173
+ return fmin(self.leftAccessoryVerticalMargin, TITLE_HMARGIN);
166
174
  }
167
175
 
168
176
  - (CGFloat)rightAccessoryVerticalMargin {
169
177
  if (self.rightAccessoryView.frameHeight < self.calloutContainerHeight)
170
- return roundf((self.calloutContainerHeight - self.rightAccessoryView.frameHeight) / 2);
178
+ return round((self.calloutContainerHeight - self.rightAccessoryView.frameHeight) / 2);
171
179
  else
172
180
  return 0;
173
181
  }
174
182
 
175
183
  - (CGFloat)rightAccessoryHorizontalMargin {
176
- return fminf(self.rightAccessoryVerticalMargin, TITLE_HMARGIN);
184
+ return fmin(self.rightAccessoryVerticalMargin, TITLE_HMARGIN);
177
185
  }
178
186
 
179
187
  - (CGFloat)innerContentMarginLeft {
@@ -229,7 +237,7 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
229
237
  else if (preferredTitleSize.width >= 0.000001 || preferredSubtitleSize.width >= 0.000001) {
230
238
 
231
239
  // if we have a title or subtitle, then our assumed margins are valid, and we can apply them
232
- preferredWidth = fmaxf(preferredTitleSize.width, preferredSubtitleSize.width) + margin;
240
+ preferredWidth = fmax(preferredTitleSize.width, preferredSubtitleSize.width) + margin;
233
241
  }
234
242
  else {
235
243
  // ok we have no title or subtitle to speak of. In this case, the system callout would actually not display
@@ -241,18 +249,18 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
241
249
  }
242
250
 
243
251
  // ensure we're big enough to fit our graphics!
244
- preferredWidth = fmaxf(preferredWidth, CALLOUT_MIN_WIDTH);
252
+ preferredWidth = fmax(preferredWidth, CALLOUT_MIN_WIDTH);
245
253
 
246
254
  // ask to be smaller if we have space, otherwise we'll fit into what we have by truncating the title/subtitle.
247
- return CGSizeMake(fminf(preferredWidth, size.width), self.calloutHeight);
255
+ return CGSizeMake(fmin(preferredWidth, size.width), self.calloutHeight);
248
256
  }
249
257
 
250
258
  - (CGSize)offsetToContainRect:(CGRect)innerRect inRect:(CGRect)outerRect {
251
- CGFloat nudgeRight = fmaxf(0, CGRectGetMinX(outerRect) - CGRectGetMinX(innerRect));
252
- CGFloat nudgeLeft = fminf(0, CGRectGetMaxX(outerRect) - CGRectGetMaxX(innerRect));
253
- CGFloat nudgeTop = fmaxf(0, CGRectGetMinY(outerRect) - CGRectGetMinY(innerRect));
254
- CGFloat nudgeBottom = fminf(0, CGRectGetMaxY(outerRect) - CGRectGetMaxY(innerRect));
255
- return CGSizeMake(nudgeLeft ? nudgeLeft : nudgeRight, nudgeTop ? nudgeTop : nudgeBottom);
259
+ CGFloat nudgeRight = fmax(0, CGRectGetMinX(outerRect) - CGRectGetMinX(innerRect));
260
+ CGFloat nudgeLeft = fmin(0, CGRectGetMaxX(outerRect) - CGRectGetMaxX(innerRect));
261
+ CGFloat nudgeTop = fmax(0, CGRectGetMinY(outerRect) - CGRectGetMinY(innerRect));
262
+ CGFloat nudgeBottom = fmin(0, CGRectGetMaxY(outerRect) - CGRectGetMaxY(innerRect));
263
+ return CGSizeMake(nudgeLeft > 0 ? nudgeLeft : nudgeRight, nudgeTop > 0 ? nudgeTop : nudgeBottom);
256
264
  }
257
265
 
258
266
  - (void)presentCalloutFromRect:(CGRect)rect inView:(UIView *)view constrainedToView:(UIView *)constrainedView animated:(BOOL)animated {
@@ -269,8 +277,9 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
269
277
  // Sanity check: dismiss this callout immediately if it's displayed somewhere
270
278
  if (self.layer.superlayer) [self dismissCalloutAnimated:NO];
271
279
 
272
- // cancel any presenting animation that may be in progress
280
+ // cancel all animations that may be in progress
273
281
  [self.layer removeAnimationForKey:@"present"];
282
+ [self.layer removeAnimationForKey:@"dismiss"];
274
283
 
275
284
  // figure out the constrained view's rect in our popup view's coordinate system
276
285
  CGRect constrainedRect = [constrainedLayer convertRect:constrainedLayer.bounds toLayer:layer];
@@ -314,7 +323,7 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
314
323
  CGFloat anchorY = self.calloutOffset.y + (bestDirection == SMCalloutArrowDirectionDown ? CGRectGetMinY(rect) : CGRectGetMaxY(rect));
315
324
 
316
325
  // we prefer to sit centered directly above our anchor
317
- CGFloat calloutX = roundf(anchorX - self.frameWidth / 2);
326
+ CGFloat calloutX = round(anchorX - self.frameWidth / 2);
318
327
 
319
328
  // but not if it's going to get too close to the edge of our constraints
320
329
  if (calloutX < constrainedRect.origin.x)
@@ -339,8 +348,8 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
339
348
  [layer addSublayer:self.layer];
340
349
 
341
350
  CGPoint calloutOrigin = {
342
- .x = calloutX + adjustX,
343
- .y = bestDirection == SMCalloutArrowDirectionDown ? (anchorY - self.calloutHeight) : anchorY
351
+ .x = calloutX + adjustX,
352
+ .y = bestDirection == SMCalloutArrowDirectionDown ? (anchorY - self.calloutHeight) : anchorY
344
353
  };
345
354
 
346
355
  self.frameOrigin = calloutOrigin;
@@ -361,8 +370,8 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
361
370
 
362
371
  // make sure our frame is not on half-pixels or else we may be blurry!
363
372
  CGFloat scale = [UIScreen mainScreen].scale;
364
- self.frameX = floorf(self.frameX*scale)/scale;
365
- self.frameY = floorf(self.frameY*scale)/scale;
373
+ self.frameX = floor(self.frameX*scale)/scale;
374
+ self.frameY = floor(self.frameY*scale)/scale;
366
375
 
367
376
  // layout now so we can immediately start animating to the final position if needed
368
377
  [self setNeedsLayout];
@@ -480,7 +489,7 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
480
489
  bounce.duration = 0.23;
481
490
  bounce.fromValue = presenting ? @0.7 : @1.0;
482
491
  bounce.toValue = presenting ? @1.0 : @0.7;
483
- bounce.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.59367:0.12066:0.18878:1.5814];
492
+ bounce.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.59367f:0.12066f:0.18878f:1.5814f];
484
493
 
485
494
  CAAnimationGroup *group = [CAAnimationGroup animation];
486
495
  group.animations = @[fade, bounce];
@@ -593,32 +602,72 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
593
602
  @property (nonatomic, strong) UIImageView *arrowImageView, *arrowHighlightedImageView, *arrowBorderView;
594
603
  @end
595
604
 
596
- static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage = nil;
605
+ static UIImage *blackArrowImage = nil, *normalArrowImageLight = nil, *normalArrowImageDark = nil, *highlightedArrowImageLight = nil, *highlightedArrowImageDark = nil, *arrowBorderImageLight = nil, *arrowBorderImageDark = nil;
606
+ static UIColor *normalBackgroundColor, *highlightedBackgroundColor, *borderColor;
597
607
 
598
608
  @implementation SMCalloutMaskedBackgroundView
599
609
 
600
610
  - (id)initWithFrame:(CGRect)frame {
601
611
  if (self = [super initWithFrame:frame]) {
602
-
612
+
613
+ UIColor *normalBackgroundColorLight = [UIColor whiteColor];
614
+ UIColor *normalBackgroundColorDark = [UIColor colorWithWhite:0.2 alpha:1.0];
615
+ UIColor *highlightedBackgroundColorLight = [UIColor colorWithWhite:0.85 alpha:1];
616
+ UIColor *highlightedBackgroundColorDark = [UIColor colorWithWhite:0.15 alpha:1];
617
+ UIColor *borderColorLight = [UIColor colorWithWhite:0 alpha:0.2];
618
+ UIColor *borderColorDark = [UIColor colorWithWhite:1 alpha:0.2];
619
+
620
+ if (@available(iOS 13.0, *)) {
621
+ normalBackgroundColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) {
622
+ if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
623
+ return normalBackgroundColorLight;
624
+ } else {
625
+ return normalBackgroundColorDark;
626
+ }
627
+ }];
628
+ highlightedBackgroundColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) {
629
+ if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
630
+ return highlightedBackgroundColorLight;
631
+ } else {
632
+ return highlightedBackgroundColorDark;
633
+ }
634
+ }];
635
+ borderColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) {
636
+ if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
637
+ return borderColorLight;
638
+ } else {
639
+ return borderColorDark;
640
+ }
641
+ }];
642
+ } else {
643
+ normalBackgroundColor = normalBackgroundColorLight;
644
+ highlightedBackgroundColor = highlightedBackgroundColorLight;
645
+ borderColor = borderColorLight;
646
+ }
647
+
603
648
  // Here we're mimicking the very particular (and odd) structure of the system callout view.
604
649
  // The hierarchy and view/layer values were discovered by inspecting map kit using Reveal.app
605
650
 
606
651
  self.containerView = [UIView new];
607
- self.containerView.backgroundColor = [UIColor whiteColor];
652
+ self.containerView.backgroundColor = normalBackgroundColor;
608
653
  self.containerView.alpha = 0.96;
609
654
  self.containerView.layer.cornerRadius = 8;
610
- self.containerView.layer.shadowRadius = 30;
611
- self.containerView.layer.shadowOpacity = 0.1;
655
+ self.layer.shadowRadius = 6;
656
+ self.layer.shadowOffset = CGSizeMake(0, 4);
657
+ self.layer.shadowOpacity = 0.1f;
612
658
 
613
659
  self.containerBorderView = [UIView new];
614
- self.containerBorderView.layer.borderColor = [UIColor colorWithWhite:0 alpha:0.1].CGColor;
615
660
  self.containerBorderView.layer.borderWidth = 0.5;
616
661
  self.containerBorderView.layer.cornerRadius = 8.5;
617
662
 
618
663
  if (!blackArrowImage) {
619
664
  blackArrowImage = [SMCalloutBackgroundView embeddedImageNamed:@"CalloutArrow"];
620
- whiteArrowImage = [self image:blackArrowImage withColor:[UIColor whiteColor]];
621
- grayArrowImage = [self image:blackArrowImage withColor:[UIColor colorWithWhite:0.85 alpha:1]];
665
+ normalArrowImageLight = [self image:blackArrowImage withColor:normalBackgroundColorLight];
666
+ normalArrowImageDark = [self image:blackArrowImage withColor:normalBackgroundColorDark];
667
+ highlightedArrowImageLight = [self image:blackArrowImage withColor:highlightedBackgroundColorLight];
668
+ highlightedArrowImageDark = [self image:blackArrowImage withColor:highlightedBackgroundColorDark];
669
+ arrowBorderImageLight = [self image:blackArrowImage withColor:borderColorLight];
670
+ arrowBorderImageDark = [self image:blackArrowImage withColor:borderColorDark];
622
671
  }
623
672
 
624
673
  self.anchorHeight = 13;
@@ -626,12 +675,12 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
626
675
 
627
676
  self.arrowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, blackArrowImage.size.width, blackArrowImage.size.height)];
628
677
  self.arrowView.alpha = 0.96;
629
- self.arrowImageView = [[UIImageView alloc] initWithImage:whiteArrowImage];
630
- self.arrowHighlightedImageView = [[UIImageView alloc] initWithImage:grayArrowImage];
678
+ self.arrowImageView = [[UIImageView alloc] initWithImage:normalArrowImageLight];
679
+ self.arrowHighlightedImageView = [[UIImageView alloc] initWithImage:highlightedArrowImageLight];
631
680
  self.arrowHighlightedImageView.hidden = YES;
632
- self.arrowBorderView = [[UIImageView alloc] initWithImage:blackArrowImage];
633
- self.arrowBorderView.alpha = 0.1;
681
+ self.arrowBorderView = [[UIImageView alloc] initWithImage:arrowBorderImageLight];
634
682
  self.arrowBorderView.frameY = 0.5;
683
+ [self updateColors];
635
684
 
636
685
  [self addSubview:self.containerView];
637
686
  [self.containerView addSubview:self.containerBorderView];
@@ -651,7 +700,7 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
651
700
 
652
701
  - (void)setHighlighted:(BOOL)highlighted {
653
702
  [super setHighlighted:highlighted];
654
- self.containerView.backgroundColor = highlighted ? [UIColor colorWithWhite:0.85 alpha:1] : [UIColor whiteColor];
703
+ self.containerView.backgroundColor = highlighted ? highlightedBackgroundColor : normalBackgroundColor;
655
704
  self.arrowImageView.hidden = highlighted;
656
705
  self.arrowHighlightedImageView.hidden = !highlighted;
657
706
  }
@@ -681,7 +730,7 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
681
730
  self.containerView.frame = CGRectMake(0, dy, self.frameWidth, self.frameHeight - self.arrowView.frameHeight + 0.5);
682
731
  self.containerBorderView.frame = CGRectInset(self.containerView.bounds, -0.5, -0.5);
683
732
 
684
- self.arrowView.frameX = roundf(self.arrowPoint.x - self.arrowView.frameWidth / 2);
733
+ self.arrowView.frameX = round(self.arrowPoint.x - self.arrowView.frameWidth / 2);
685
734
 
686
735
  if (pointingUp) {
687
736
  self.arrowView.frameY = 1;
@@ -693,6 +742,33 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
693
742
  }
694
743
  }
695
744
 
745
+ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
746
+ [super traitCollectionDidChange:previousTraitCollection];
747
+ [self updateColors];
748
+ }
749
+
750
+ - (void)updateColors {
751
+ if (@available(iOS 13.0, *)) {
752
+ [self.traitCollection performAsCurrentTraitCollection:^{
753
+ if (UITraitCollection.currentTraitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
754
+ self.arrowImageView.image = normalArrowImageLight;
755
+ self.arrowHighlightedImageView.image = highlightedArrowImageLight;
756
+ self.arrowBorderView.image = arrowBorderImageLight;
757
+ } else {
758
+ self.arrowImageView.image = normalArrowImageDark;
759
+ self.arrowHighlightedImageView.image = highlightedArrowImageDark;
760
+ self.arrowBorderView.image = arrowBorderImageDark;
761
+ }
762
+ self.containerBorderView.layer.borderColor = borderColor.CGColor;
763
+ }];
764
+ } else {
765
+ self.arrowImageView.image = normalArrowImageLight;
766
+ self.arrowHighlightedImageView.image = highlightedArrowImageLight;
767
+ self.arrowBorderView.image = arrowBorderImageLight;
768
+ self.containerBorderView.layer.borderColor = borderColor.CGColor;
769
+ }
770
+ }
771
+
696
772
  - (CALayer *)contentMask {
697
773
 
698
774
  UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 0);
@@ -712,83 +788,6 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
712
788
 
713
789
  @implementation SMCalloutBackgroundView
714
790
 
715
- + (NSData *)dataWithBase64EncodedString:(NSString *)string {
716
- //
717
- // NSData+Base64.m
718
- //
719
- // Version 1.0.2
720
- //
721
- // Created by Nick Lockwood on 12/01/2012.
722
- // Copyright (C) 2012 Charcoal Design
723
- //
724
- // Distributed under the permissive zlib License
725
- // Get the latest version from here:
726
- //
727
- // https://github.com/nicklockwood/Base64
728
- //
729
- // This software is provided 'as-is', without any express or implied
730
- // warranty. In no event will the authors be held liable for any damages
731
- // arising from the use of this software.
732
- //
733
- // Permission is granted to anyone to use this software for any purpose,
734
- // including commercial applications, and to alter it and redistribute it
735
- // freely, subject to the following restrictions:
736
- //
737
- // 1. The origin of this software must not be misrepresented; you must not
738
- // claim that you wrote the original software. If you use this software
739
- // in a product, an acknowledgment in the product documentation would be
740
- // appreciated but is not required.
741
- //
742
- // 2. Altered source versions must be plainly marked as such, and must not be
743
- // misrepresented as being the original software.
744
- //
745
- // 3. This notice may not be removed or altered from any source distribution.
746
- //
747
- const char lookup[] = {
748
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
749
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
750
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 62, 99, 99, 99, 63,
751
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 99, 99, 99, 99, 99, 99,
752
- 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
753
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 99, 99, 99, 99, 99,
754
- 99, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
755
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 99, 99, 99, 99, 99
756
- };
757
-
758
- NSData *inputData = [string dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
759
- long long inputLength = [inputData length];
760
- const unsigned char *inputBytes = [inputData bytes];
761
-
762
- long long maxOutputLength = (inputLength / 4 + 1) * 3;
763
- NSMutableData *outputData = [NSMutableData dataWithLength:(NSUInteger)maxOutputLength];
764
- unsigned char *outputBytes = (unsigned char *)[outputData mutableBytes];
765
-
766
- int accumulator = 0;
767
- long long outputLength = 0;
768
- unsigned char accumulated[] = {0, 0, 0, 0};
769
- for (long long i = 0; i < inputLength; i++) {
770
- unsigned char decoded = lookup[inputBytes[i] & 0x7F];
771
- if (decoded != 99) {
772
- accumulated[accumulator] = decoded;
773
- if (accumulator == 3) {
774
- outputBytes[outputLength++] = (accumulated[0] << 2) | (accumulated[1] >> 4);
775
- outputBytes[outputLength++] = (accumulated[1] << 4) | (accumulated[2] >> 2);
776
- outputBytes[outputLength++] = (accumulated[2] << 6) | accumulated[3];
777
- }
778
- accumulator = (accumulator + 1) % 4;
779
- }
780
- }
781
-
782
- //handle left-over data
783
- if (accumulator > 0) outputBytes[outputLength] = (accumulated[0] << 2) | (accumulated[1] >> 4);
784
- if (accumulator > 1) outputBytes[++outputLength] = (accumulated[1] << 4) | (accumulated[2] >> 2);
785
- if (accumulator > 2) outputLength++;
786
-
787
- //truncate data to match actual output length
788
- outputData.length = (NSUInteger)outputLength;
789
- return outputLength? outputData: nil;
790
- }
791
-
792
791
  + (UIImage *)embeddedImageNamed:(NSString *)name {
793
792
  CGFloat screenScale = [UIScreen mainScreen].scale;
794
793
  if (screenScale > 1.0) {
@@ -809,7 +808,8 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
809
808
  NSString *base64String = [(id)self performSelector:selector];
810
809
  #pragma clang diagnostic pop
811
810
 
812
- UIImage *rawImage = [UIImage imageWithData:[self dataWithBase64EncodedString:base64String]];
811
+ NSData *imageData = [[NSData alloc] initWithBase64EncodedString:base64String options:0];
812
+ UIImage *rawImage = [UIImage imageWithData:imageData];
813
813
  return [UIImage imageWithCGImage:rawImage.CGImage scale:screenScale orientation:UIImageOrientationUp];
814
814
  }
815
815
 
@@ -844,15 +844,15 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
844
844
  - (void)setFrameHeight:(CGFloat)height { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=self.frame.size.width, .size.height=height }; }
845
845
 
846
846
  - (CGFloat)frameLeft { return self.frame.origin.x; }
847
- - (void)setFrameLeft:(CGFloat)left { self.frame = (CGRect){ .origin.x=left, .origin.y=self.frame.origin.y, .size.width=fmaxf(self.frame.origin.x+self.frame.size.width-left,0), .size.height=self.frame.size.height }; }
847
+ - (void)setFrameLeft:(CGFloat)left { self.frame = (CGRect){ .origin.x=left, .origin.y=self.frame.origin.y, .size.width=fmax(self.frame.origin.x+self.frame.size.width-left,0), .size.height=self.frame.size.height }; }
848
848
 
849
849
  - (CGFloat)frameTop { return self.frame.origin.y; }
850
- - (void)setFrameTop:(CGFloat)top { self.frame = (CGRect){ .origin.x=self.frame.origin.x, .origin.y=top, .size.width=self.frame.size.width, .size.height=fmaxf(self.frame.origin.y+self.frame.size.height-top,0) }; }
850
+ - (void)setFrameTop:(CGFloat)top { self.frame = (CGRect){ .origin.x=self.frame.origin.x, .origin.y=top, .size.width=self.frame.size.width, .size.height=fmax(self.frame.origin.y+self.frame.size.height-top,0) }; }
851
851
 
852
852
  - (CGFloat)frameRight { return self.frame.origin.x + self.frame.size.width; }
853
- - (void)setFrameRight:(CGFloat)right { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=fmaxf(right-self.frame.origin.x,0), .size.height=self.frame.size.height }; }
853
+ - (void)setFrameRight:(CGFloat)right { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=fmax(right-self.frame.origin.x,0), .size.height=self.frame.size.height }; }
854
854
 
855
855
  - (CGFloat)frameBottom { return self.frame.origin.y + self.frame.size.height; }
856
- - (void)setFrameBottom:(CGFloat)bottom { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=self.frame.size.width, .size.height=fmaxf(bottom-self.frame.origin.y,0) }; }
856
+ - (void)setFrameBottom:(CGFloat)bottom { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=self.frame.size.width, .size.height=fmax(bottom-self.frame.origin.y,0) }; }
857
857
 
858
- @end
858
+ @end
@@ -7,7 +7,7 @@
7
7
  #import <MapKit/MapKit.h>
8
8
  #import <React/RCTConvert.h>
9
9
 
10
- @interface RCTConvert (AirMap)
10
+ @interface RCTConvert (RNMMap)
11
11
 
12
12
  + (MKCoordinateSpan)MKCoordinateSpan:(id)json;
13
13
  + (MKCoordinateRegion)MKCoordinateRegion:(id)json;
@@ -3,12 +3,12 @@
3
3
  // Copyright (c) 2015 Facebook. All rights reserved.
4
4
  //
5
5
 
6
- #import "RCTConvert+AirMap.h"
6
+ #import "RCTConvert+RNMMap.h"
7
7
 
8
8
  #import <React/RCTConvert+CoreLocation.h>
9
- #import "AIRMapCoordinate.h"
9
+ #import "RNMMapCoordinate.h"
10
10
 
11
- @implementation RCTConvert (AirMap)
11
+ @implementation RCTConvert (RNMMap)
12
12
 
13
13
  + (MKCoordinateSpan)MKCoordinateSpan:(id)json
14
14
  {
@@ -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),
@@ -71,18 +88,18 @@ RCT_ENUM_CONVERTER(MKMapType, (@{
71
88
  // around a `CLLocationCoordinate2D`, since I was unable to figure out
72
89
  // how to handle an array of structs like CLLocationCoordinate2D. Would love
73
90
  // to get rid of this if someone can show me how...
74
- + (AIRMapCoordinate *)AIRMapCoordinate:(id)json
91
+ + (RNMMapCoordinate *)RNMMapCoordinate:(id)json
75
92
  {
76
- AIRMapCoordinate *coord = [AIRMapCoordinate new];
93
+ RNMMapCoordinate *coord = [RNMMapCoordinate new];
77
94
  coord.coordinate = [self CLLocationCoordinate2D:json];
78
95
  return coord;
79
96
  }
80
97
 
81
- RCT_ARRAY_CONVERTER(AIRMapCoordinate)
98
+ RCT_ARRAY_CONVERTER(RNMMapCoordinate)
82
99
 
83
- + (NSArray<NSArray<AIRMapCoordinate *> *> *)AIRMapCoordinateArrayArray:(id)json
100
+ + (NSArray<NSArray<RNMMapCoordinate *> *> *)RNMMapCoordinateArrayArray:(id)json
84
101
  {
85
- return RCTConvertArrayValue(@selector(AIRMapCoordinateArray:), json);
102
+ return RCTConvertArrayValue(@selector(RNMMapCoordinateArray:), json);
86
103
  }
87
104
 
88
105
  @end
@@ -12,16 +12,16 @@
12
12
 
13
13
  #import <React/RCTComponent.h>
14
14
  #import "SMCalloutView.h"
15
- #import "RCTConvert+AirMap.h"
16
- #import "AIRMapCalloutSubview.h"
15
+ #import "RCTConvert+RNMMap.h"
16
+ #import "RNMMapCalloutSubview.h"
17
17
 
18
- @class AIRMapMarker;
18
+ @class RNMMapMarker;
19
19
 
20
- extern const NSTimeInterval AIRMapRegionChangeObserveInterval;
21
- extern const CGFloat AIRMapZoomBoundBuffer;
22
- extern const NSInteger AIRMapMaxZoomLevel;
20
+ extern const NSTimeInterval RNMMapRegionChangeObserveInterval;
21
+ extern const CGFloat RNMMapZoomBoundBuffer;
22
+ extern const NSInteger RNMMapMaxZoomLevel;
23
23
 
24
- @interface AIRMap: MKMapView<SMCalloutViewDelegate>
24
+ @interface RNMMap: MKMapView<SMCalloutViewDelegate>
25
25
 
26
26
  @property (nonatomic, strong) SMCalloutView *calloutView;
27
27
  @property (nonatomic, strong) UIImageView *cacheImageView;
@@ -73,7 +73,7 @@ extern const NSInteger AIRMapMaxZoomLevel;
73
73
  - (void)finishLoading;
74
74
  - (NSArray *)getMapBoundaries;
75
75
 
76
- - (AIRMapMarker*) markerAtPoint:(CGPoint)point;
76
+ - (RNMMapMarker*) markerAtPoint:(CGPoint)point;
77
77
  - (NSDictionary*) getMarkersFramesWithOnlyVisible:(BOOL)onlyVisible;
78
78
 
79
79
  @end