@rnmapbox/maps 10.0.0-beta.69 → 10.0.0-beta.71

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 (262) hide show
  1. package/android/rctmgl/build.gradle +1 -1
  2. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/annotation/RCTMGLMarkerView.kt +0 -1
  3. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/RCTMGLCamera.kt +78 -53
  4. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/RCTMGLCameraManager.kt +16 -13
  5. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/location/LocationComponentManager.kt +125 -83
  6. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/location/RCTMGLNativeUserLocation.kt +33 -7
  7. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/location/RCTMGLNativeUserLocationManager.kt +32 -0
  8. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/location/UserTrackingMode.kt +42 -0
  9. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.kt +114 -38
  10. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/mapview/helpers/CameraChangeTracker.kt +23 -0
  11. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/events/MapUserTrackingModeEvent.kt +21 -0
  12. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/location/LocationManager.kt +64 -25
  13. package/index.d.ts +14 -62
  14. package/ios/RCTMGL-v10/MGLModule.swift +1 -0
  15. package/ios/RCTMGL-v10/RCTMGLAtmosphere.swift +1 -0
  16. package/ios/RCTMGL-v10/RCTMGLBackgroundLayer.swift +1 -0
  17. package/ios/RCTMGL-v10/RCTMGLCamera.swift +52 -26
  18. package/ios/RCTMGL-v10/RCTMGLCameraManager.m +5 -2
  19. package/ios/RCTMGL-v10/RCTMGLCircleLayer.swift +1 -0
  20. package/ios/RCTMGL-v10/RCTMGLEvent.swift +1 -0
  21. package/ios/RCTMGL-v10/RCTMGLFillExtrustionLayer.swift +1 -0
  22. package/ios/RCTMGL-v10/RCTMGLFillLayer.swift +1 -0
  23. package/ios/RCTMGL-v10/RCTMGLHeatmapLayer.swift +1 -0
  24. package/ios/RCTMGL-v10/RCTMGLImages.swift +54 -8
  25. package/ios/RCTMGL-v10/RCTMGLLayer.swift +4 -0
  26. package/ios/RCTMGL-v10/RCTMGLLight.swift +5 -3
  27. package/ios/RCTMGL-v10/RCTMGLLineLayer.swift +1 -0
  28. package/ios/RCTMGL-v10/RCTMGLLocationModule.m +4 -0
  29. package/ios/RCTMGL-v10/RCTMGLLocationModule.swift +101 -5
  30. package/ios/RCTMGL-v10/RCTMGLMapView.swift +15 -2
  31. package/ios/RCTMGL-v10/RCTMGLRasterLayer.swift +1 -0
  32. package/ios/RCTMGL-v10/RCTMGLSingletonLayer.swift +4 -0
  33. package/ios/RCTMGL-v10/RCTMGLSkyLayer.swift +1 -0
  34. package/ios/RCTMGL-v10/RCTMGLStyle.swift +58 -123
  35. package/ios/RCTMGL-v10/RCTMGLStyleValue.swift +51 -5
  36. package/ios/RCTMGL-v10/RCTMGLSymbolLayer.swift +1 -0
  37. package/ios/RCTMGL-v10/RCTMGLTerrain.swift +1 -0
  38. package/ios/install.md +1 -1
  39. package/javascript/components/Camera.tsx +7 -3
  40. package/javascript/components/Images.tsx +133 -0
  41. package/javascript/components/MapView.js +22 -2
  42. package/javascript/modules/location/locationManager.ts +227 -0
  43. package/javascript/utils/MapboxStyles.d.ts +3 -3
  44. package/javascript/utils/styleMap.ts +2 -2
  45. package/lib/commonjs/classes/AnimatedCoordinatesArray.js.map +1 -1
  46. package/lib/commonjs/classes/AnimatedExtractCoordinateFromArray.js +2 -5
  47. package/lib/commonjs/classes/AnimatedExtractCoordinateFromArray.js.map +1 -1
  48. package/lib/commonjs/classes/AnimatedPoint.js.map +1 -1
  49. package/lib/commonjs/classes/AnimatedRouteCoordinatesArray.js.map +1 -1
  50. package/lib/commonjs/classes/AnimatedShape.js.map +1 -1
  51. package/lib/commonjs/classes/index.d.js.map +1 -1
  52. package/lib/commonjs/classes/index.js.map +1 -1
  53. package/lib/commonjs/components/AbstractLayer.js +6 -10
  54. package/lib/commonjs/components/AbstractLayer.js.map +1 -1
  55. package/lib/commonjs/components/AbstractSource.js +3 -10
  56. package/lib/commonjs/components/AbstractSource.js.map +1 -1
  57. package/lib/commonjs/components/Atmosphere.js.map +1 -1
  58. package/lib/commonjs/components/BackgroundLayer.js +3 -6
  59. package/lib/commonjs/components/BackgroundLayer.js.map +1 -1
  60. package/lib/commonjs/components/Callout.js +27 -30
  61. package/lib/commonjs/components/Callout.js.map +1 -1
  62. package/lib/commonjs/components/Camera.js +3 -1
  63. package/lib/commonjs/components/Camera.js.map +1 -1
  64. package/lib/commonjs/components/CircleLayer.js +3 -6
  65. package/lib/commonjs/components/CircleLayer.js.map +1 -1
  66. package/lib/commonjs/components/FillExtrusionLayer.js +3 -6
  67. package/lib/commonjs/components/FillExtrusionLayer.js.map +1 -1
  68. package/lib/commonjs/components/FillLayer.js +3 -6
  69. package/lib/commonjs/components/FillLayer.js.map +1 -1
  70. package/lib/commonjs/components/HeadingIndicator.js.map +1 -1
  71. package/lib/commonjs/components/HeatmapLayer.js +3 -6
  72. package/lib/commonjs/components/HeatmapLayer.js.map +1 -1
  73. package/lib/commonjs/components/ImageSource.js +16 -19
  74. package/lib/commonjs/components/ImageSource.js.map +1 -1
  75. package/lib/commonjs/components/Images.js +3 -34
  76. package/lib/commonjs/components/Images.js.map +1 -1
  77. package/lib/commonjs/components/Light.js +7 -10
  78. package/lib/commonjs/components/Light.js.map +1 -1
  79. package/lib/commonjs/components/LineLayer.js +3 -6
  80. package/lib/commonjs/components/LineLayer.js.map +1 -1
  81. package/lib/commonjs/components/MapView.js +241 -227
  82. package/lib/commonjs/components/MapView.js.map +1 -1
  83. package/lib/commonjs/components/MarkerView.js +9 -16
  84. package/lib/commonjs/components/MarkerView.js.map +1 -1
  85. package/lib/commonjs/components/NativeBridgeComponent.js +0 -7
  86. package/lib/commonjs/components/NativeBridgeComponent.js.map +1 -1
  87. package/lib/commonjs/components/NativeUserLocation.js.map +1 -1
  88. package/lib/commonjs/components/PointAnnotation.js +8 -11
  89. package/lib/commonjs/components/PointAnnotation.js.map +1 -1
  90. package/lib/commonjs/components/RasterDemSource.js +36 -39
  91. package/lib/commonjs/components/RasterDemSource.js.map +1 -1
  92. package/lib/commonjs/components/RasterLayer.js +3 -6
  93. package/lib/commonjs/components/RasterLayer.js.map +1 -1
  94. package/lib/commonjs/components/RasterSource.js +45 -48
  95. package/lib/commonjs/components/RasterSource.js.map +1 -1
  96. package/lib/commonjs/components/ShapeSource.js +4 -7
  97. package/lib/commonjs/components/ShapeSource.js.map +1 -1
  98. package/lib/commonjs/components/SkyLayer.js +3 -6
  99. package/lib/commonjs/components/SkyLayer.js.map +1 -1
  100. package/lib/commonjs/components/Style.js.map +1 -1
  101. package/lib/commonjs/components/SymbolLayer.js +3 -6
  102. package/lib/commonjs/components/SymbolLayer.js.map +1 -1
  103. package/lib/commonjs/components/Terrain.js.map +1 -1
  104. package/lib/commonjs/components/UserLocation.js +65 -69
  105. package/lib/commonjs/components/UserLocation.js.map +1 -1
  106. package/lib/commonjs/components/VectorSource.js +63 -66
  107. package/lib/commonjs/components/VectorSource.js.map +1 -1
  108. package/lib/commonjs/components/annotations/Annotation.js +16 -19
  109. package/lib/commonjs/components/annotations/Annotation.js.map +1 -1
  110. package/lib/commonjs/index.js.map +1 -1
  111. package/lib/commonjs/index.web.js.map +1 -1
  112. package/lib/commonjs/modules/location/locationManager.js +37 -9
  113. package/lib/commonjs/modules/location/locationManager.js.map +1 -1
  114. package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js.map +1 -1
  115. package/lib/commonjs/modules/offline/OfflinePack.js.map +1 -1
  116. package/lib/commonjs/modules/offline/offlineManager.js.map +1 -1
  117. package/lib/commonjs/modules/snapshot/SnapshotOptions.js.map +1 -1
  118. package/lib/commonjs/modules/snapshot/snapshotManager.js.map +1 -1
  119. package/lib/commonjs/requestAndroidLocationPermissions.js.map +1 -1
  120. package/lib/commonjs/types/index.js.map +1 -1
  121. package/lib/commonjs/utils/BridgeValue.js +0 -4
  122. package/lib/commonjs/utils/BridgeValue.js.map +1 -1
  123. package/lib/commonjs/utils/Logger.js +1 -4
  124. package/lib/commonjs/utils/Logger.js.map +1 -1
  125. package/lib/commonjs/utils/MapboxStyles.d.js.map +1 -1
  126. package/lib/commonjs/utils/StyleValue.js.map +1 -1
  127. package/lib/commonjs/utils/animated/Animated.js.map +1 -1
  128. package/lib/commonjs/utils/deprecation.js.map +1 -1
  129. package/lib/commonjs/utils/filterUtils.js.map +1 -1
  130. package/lib/commonjs/utils/geoUtils.d.js.map +1 -1
  131. package/lib/commonjs/utils/geoUtils.js.map +1 -1
  132. package/lib/commonjs/utils/getAnnotationsLayerID.js.map +1 -1
  133. package/lib/commonjs/utils/index.d.js.map +1 -1
  134. package/lib/commonjs/utils/index.js.map +1 -1
  135. package/lib/commonjs/utils/styleMap.js +2 -2
  136. package/lib/commonjs/utils/styleMap.js.map +1 -1
  137. package/lib/commonjs/web/MapContext.js.map +1 -1
  138. package/lib/commonjs/web/MapboxModule.js.map +1 -1
  139. package/lib/commonjs/web/UnimplementedComponent.js.map +1 -1
  140. package/lib/commonjs/web/components/Camera.js +2 -9
  141. package/lib/commonjs/web/components/Camera.js.map +1 -1
  142. package/lib/commonjs/web/components/MapView.js +5 -11
  143. package/lib/commonjs/web/components/MapView.js.map +1 -1
  144. package/lib/commonjs/web/index.js.map +1 -1
  145. package/lib/commonjs/web/utils/Logger.js +3 -7
  146. package/lib/commonjs/web/utils/Logger.js.map +1 -1
  147. package/lib/module/classes/AnimatedCoordinatesArray.js.map +1 -1
  148. package/lib/module/classes/AnimatedExtractCoordinateFromArray.js +2 -5
  149. package/lib/module/classes/AnimatedExtractCoordinateFromArray.js.map +1 -1
  150. package/lib/module/classes/AnimatedPoint.js.map +1 -1
  151. package/lib/module/classes/AnimatedRouteCoordinatesArray.js.map +1 -1
  152. package/lib/module/classes/AnimatedShape.js.map +1 -1
  153. package/lib/module/classes/index.d.js.map +1 -1
  154. package/lib/module/classes/index.js.map +1 -1
  155. package/lib/module/components/AbstractLayer.js +4 -10
  156. package/lib/module/components/AbstractLayer.js.map +1 -1
  157. package/lib/module/components/AbstractSource.js +3 -10
  158. package/lib/module/components/AbstractSource.js.map +1 -1
  159. package/lib/module/components/Atmosphere.js.map +1 -1
  160. package/lib/module/components/BackgroundLayer.js +3 -6
  161. package/lib/module/components/BackgroundLayer.js.map +1 -1
  162. package/lib/module/components/Callout.js +27 -30
  163. package/lib/module/components/Callout.js.map +1 -1
  164. package/lib/module/components/Camera.js +3 -1
  165. package/lib/module/components/Camera.js.map +1 -1
  166. package/lib/module/components/CircleLayer.js +3 -6
  167. package/lib/module/components/CircleLayer.js.map +1 -1
  168. package/lib/module/components/FillExtrusionLayer.js +3 -6
  169. package/lib/module/components/FillExtrusionLayer.js.map +1 -1
  170. package/lib/module/components/FillLayer.js +3 -6
  171. package/lib/module/components/FillLayer.js.map +1 -1
  172. package/lib/module/components/HeadingIndicator.js.map +1 -1
  173. package/lib/module/components/HeatmapLayer.js +3 -6
  174. package/lib/module/components/HeatmapLayer.js.map +1 -1
  175. package/lib/module/components/ImageSource.js +16 -19
  176. package/lib/module/components/ImageSource.js.map +1 -1
  177. package/lib/module/components/Images.js +3 -34
  178. package/lib/module/components/Images.js.map +1 -1
  179. package/lib/module/components/Light.js +7 -10
  180. package/lib/module/components/Light.js.map +1 -1
  181. package/lib/module/components/LineLayer.js +3 -6
  182. package/lib/module/components/LineLayer.js.map +1 -1
  183. package/lib/module/components/MapView.js +241 -227
  184. package/lib/module/components/MapView.js.map +1 -1
  185. package/lib/module/components/MarkerView.js +9 -16
  186. package/lib/module/components/MarkerView.js.map +1 -1
  187. package/lib/module/components/NativeBridgeComponent.js +0 -7
  188. package/lib/module/components/NativeBridgeComponent.js.map +1 -1
  189. package/lib/module/components/NativeUserLocation.js.map +1 -1
  190. package/lib/module/components/PointAnnotation.js +8 -11
  191. package/lib/module/components/PointAnnotation.js.map +1 -1
  192. package/lib/module/components/RasterDemSource.js +36 -39
  193. package/lib/module/components/RasterDemSource.js.map +1 -1
  194. package/lib/module/components/RasterLayer.js +3 -6
  195. package/lib/module/components/RasterLayer.js.map +1 -1
  196. package/lib/module/components/RasterSource.js +45 -48
  197. package/lib/module/components/RasterSource.js.map +1 -1
  198. package/lib/module/components/ShapeSource.js +4 -7
  199. package/lib/module/components/ShapeSource.js.map +1 -1
  200. package/lib/module/components/SkyLayer.js +3 -6
  201. package/lib/module/components/SkyLayer.js.map +1 -1
  202. package/lib/module/components/Style.js.map +1 -1
  203. package/lib/module/components/SymbolLayer.js +3 -6
  204. package/lib/module/components/SymbolLayer.js.map +1 -1
  205. package/lib/module/components/Terrain.js.map +1 -1
  206. package/lib/module/components/UserLocation.js +65 -69
  207. package/lib/module/components/UserLocation.js.map +1 -1
  208. package/lib/module/components/VectorSource.js +63 -66
  209. package/lib/module/components/VectorSource.js.map +1 -1
  210. package/lib/module/components/annotations/Annotation.js +16 -19
  211. package/lib/module/components/annotations/Annotation.js.map +1 -1
  212. package/lib/module/modules/location/locationManager.js +38 -9
  213. package/lib/module/modules/location/locationManager.js.map +1 -1
  214. package/lib/module/modules/offline/OfflineCreatePackOptions.js.map +1 -1
  215. package/lib/module/modules/offline/OfflinePack.js.map +1 -1
  216. package/lib/module/modules/offline/offlineManager.js.map +1 -1
  217. package/lib/module/modules/snapshot/SnapshotOptions.js.map +1 -1
  218. package/lib/module/modules/snapshot/snapshotManager.js.map +1 -1
  219. package/lib/module/requestAndroidLocationPermissions.js.map +1 -1
  220. package/lib/module/types/index.js.map +1 -1
  221. package/lib/module/utils/BridgeValue.js +0 -4
  222. package/lib/module/utils/BridgeValue.js.map +1 -1
  223. package/lib/module/utils/Logger.js +1 -4
  224. package/lib/module/utils/Logger.js.map +1 -1
  225. package/lib/module/utils/MapboxStyles.d.js.map +1 -1
  226. package/lib/module/utils/StyleValue.js.map +1 -1
  227. package/lib/module/utils/animated/Animated.js.map +1 -1
  228. package/lib/module/utils/deprecation.js.map +1 -1
  229. package/lib/module/utils/filterUtils.js.map +1 -1
  230. package/lib/module/utils/geoUtils.d.js.map +1 -1
  231. package/lib/module/utils/geoUtils.js.map +1 -1
  232. package/lib/module/utils/getAnnotationsLayerID.js.map +1 -1
  233. package/lib/module/utils/index.d.js.map +1 -1
  234. package/lib/module/utils/index.js.map +1 -1
  235. package/lib/module/utils/styleMap.js +2 -2
  236. package/lib/module/utils/styleMap.js.map +1 -1
  237. package/lib/module/web/MapContext.js.map +1 -1
  238. package/lib/module/web/MapboxModule.js.map +1 -1
  239. package/lib/module/web/UnimplementedComponent.js.map +1 -1
  240. package/lib/module/web/components/Camera.js +2 -9
  241. package/lib/module/web/components/Camera.js.map +1 -1
  242. package/lib/module/web/components/MapView.js +5 -11
  243. package/lib/module/web/components/MapView.js.map +1 -1
  244. package/lib/module/web/index.js.map +1 -1
  245. package/lib/module/web/utils/Logger.js +3 -7
  246. package/lib/module/web/utils/Logger.js.map +1 -1
  247. package/lib/typescript/components/Camera.d.ts +4 -2
  248. package/lib/typescript/components/Camera.d.ts.map +1 -1
  249. package/lib/typescript/components/Images.d.ts +57 -0
  250. package/lib/typescript/components/Images.d.ts.map +1 -0
  251. package/lib/typescript/modules/location/locationManager.d.ts +87 -0
  252. package/lib/typescript/modules/location/locationManager.d.ts.map +1 -0
  253. package/lib/typescript/utils/styleMap.d.ts +2 -2
  254. package/package.json +1 -1
  255. package/rnmapbox-maps.podspec +1 -1
  256. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/location/RCTMGLNativeUserLocationManager.java +0 -34
  257. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/location/RenderMode.kt +0 -21
  258. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/location/UserTrackingMode.java +0 -54
  259. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/mapview/helpers/CameraChangeTracker.java +0 -37
  260. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/location/UserLocationVerticalAlignment.java +0 -7
  261. package/javascript/components/Images.js +0 -118
  262. package/javascript/modules/location/locationManager.js +0 -136
@@ -12,7 +12,7 @@ class RCTMGLStyle {
12
12
  }
13
13
 
14
14
 
15
- func fillLayer(layer: inout FillLayer, reactStyle:Dictionary<String, Any>, applyUpdater: @escaping ((inout FillLayer)->Void)->Void, isValid: @escaping () -> Bool)
15
+ func fillLayer(layer: inout FillLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout FillLayer)->Void)->Void, isValid: @escaping () -> Bool)
16
16
  {
17
17
  guard self._hasReactStyle(reactStyle) else {
18
18
  Logger.log(level:.error, message: "Invalid style: \(reactStyle)")
@@ -52,35 +52,22 @@ func fillLayer(layer: inout FillLayer, reactStyle:Dictionary<String, Any>, apply
52
52
  } else if (prop == "fillTranslateAnchor") {
53
53
  self.setFillTranslateAnchor(&layer, styleValue:styleValue);
54
54
  } else if (prop == "fillPattern") {
55
- if (!styleValue.shouldAddImage()) {
56
- self.setFillPattern(&layer, styleValue:styleValue);
57
- } else {
58
- let imageURI = styleValue.getImageURI()
59
-
60
- RCTMGLUtils.fetchImage(bridge!, url:imageURI, scale:styleValue.getImageScale(), callback:{ (error, image) in
61
- if let image = image {
62
- DispatchQueue.main.sync {
63
- if (isValid()) {
64
- logged("Fill.FillPattern.addImage") {
65
- try self.style.addImage(image, id:imageURI!, stretchX: [], stretchY: []);
66
- applyUpdater { (layer: inout FillLayer) in
67
- self.setFillPattern(&layer, styleValue:styleValue);
68
- }
69
- }
70
- }
71
- }
72
- } else {
73
- Logger.log(level: .error, message: "Error during fetchImage: \(optional: error)")
74
- }
75
- });
76
- }
55
+ styleValue.setImage(
56
+ bridge: bridge!,
57
+ style: style,
58
+ oldValue: oldReactStyle?[prop],
59
+ setImageOnLayer: { (_) in self.setFillPattern(&layer, styleValue:styleValue) },
60
+ isLayerStillValid: isValid,
61
+ setImageOnLayerLater: { (_) in applyUpdater { (layer: inout FillLayer) in self.setFillPattern(&layer, styleValue: styleValue) } },
62
+ name: "Fill.\(prop)"
63
+ )
77
64
  } else {
78
65
  Logger.log(level:.error, message: "Unexpected property \(prop) for layer: fill")
79
66
  }
80
67
  }
81
68
  }
82
69
 
83
- func lineLayer(layer: inout LineLayer, reactStyle:Dictionary<String, Any>, applyUpdater: @escaping ((inout LineLayer)->Void)->Void, isValid: @escaping () -> Bool)
70
+ func lineLayer(layer: inout LineLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout LineLayer)->Void)->Void, isValid: @escaping () -> Bool)
84
71
  {
85
72
  guard self._hasReactStyle(reactStyle) else {
86
73
  Logger.log(level:.error, message: "Invalid style: \(reactStyle)")
@@ -140,28 +127,15 @@ func lineLayer(layer: inout LineLayer, reactStyle:Dictionary<String, Any>, apply
140
127
  } else if (prop == "lineDasharray") {
141
128
  self.setLineDasharray(&layer, styleValue:styleValue);
142
129
  } else if (prop == "linePattern") {
143
- if (!styleValue.shouldAddImage()) {
144
- self.setLinePattern(&layer, styleValue:styleValue);
145
- } else {
146
- let imageURI = styleValue.getImageURI()
147
-
148
- RCTMGLUtils.fetchImage(bridge!, url:imageURI, scale:styleValue.getImageScale(), callback:{ (error, image) in
149
- if let image = image {
150
- DispatchQueue.main.sync {
151
- if (isValid()) {
152
- logged("Line.LinePattern.addImage") {
153
- try self.style.addImage(image, id:imageURI!, stretchX: [], stretchY: []);
154
- applyUpdater { (layer: inout LineLayer) in
155
- self.setLinePattern(&layer, styleValue:styleValue);
156
- }
157
- }
158
- }
159
- }
160
- } else {
161
- Logger.log(level: .error, message: "Error during fetchImage: \(optional: error)")
162
- }
163
- });
164
- }
130
+ styleValue.setImage(
131
+ bridge: bridge!,
132
+ style: style,
133
+ oldValue: oldReactStyle?[prop],
134
+ setImageOnLayer: { (_) in self.setLinePattern(&layer, styleValue:styleValue) },
135
+ isLayerStillValid: isValid,
136
+ setImageOnLayerLater: { (_) in applyUpdater { (layer: inout LineLayer) in self.setLinePattern(&layer, styleValue: styleValue) } },
137
+ name: "Line.\(prop)"
138
+ )
165
139
  } else if (prop == "lineGradient") {
166
140
  self.setLineGradient(&layer, styleValue:styleValue);
167
141
  } else if (prop == "lineTrimOffset") {
@@ -172,7 +146,7 @@ func lineLayer(layer: inout LineLayer, reactStyle:Dictionary<String, Any>, apply
172
146
  }
173
147
  }
174
148
 
175
- func symbolLayer(layer: inout SymbolLayer, reactStyle:Dictionary<String, Any>, applyUpdater: @escaping ((inout SymbolLayer)->Void)->Void, isValid: @escaping () -> Bool)
149
+ func symbolLayer(layer: inout SymbolLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout SymbolLayer)->Void)->Void, isValid: @escaping () -> Bool)
176
150
  {
177
151
  guard self._hasReactStyle(reactStyle) else {
178
152
  Logger.log(level:.error, message: "Invalid style: \(reactStyle)")
@@ -212,28 +186,15 @@ func symbolLayer(layer: inout SymbolLayer, reactStyle:Dictionary<String, Any>, a
212
186
  } else if (prop == "iconTextFitPadding") {
213
187
  self.setIconTextFitPadding(&layer, styleValue:styleValue);
214
188
  } else if (prop == "iconImage") {
215
- if (!styleValue.shouldAddImage()) {
216
- self.setIconImage(&layer, styleValue:styleValue);
217
- } else {
218
- let imageURI = styleValue.getImageURI()
219
-
220
- RCTMGLUtils.fetchImage(bridge!, url:imageURI, scale:styleValue.getImageScale(), callback:{ (error, image) in
221
- if let image = image {
222
- DispatchQueue.main.sync {
223
- if (isValid()) {
224
- logged("Symbol.IconImage.addImage") {
225
- try self.style.addImage(image, id:imageURI!, stretchX: [], stretchY: []);
226
- applyUpdater { (layer: inout SymbolLayer) in
227
- self.setIconImage(&layer, styleValue:styleValue);
228
- }
229
- }
230
- }
231
- }
232
- } else {
233
- Logger.log(level: .error, message: "Error during fetchImage: \(optional: error)")
234
- }
235
- });
236
- }
189
+ styleValue.setImage(
190
+ bridge: bridge!,
191
+ style: style,
192
+ oldValue: oldReactStyle?[prop],
193
+ setImageOnLayer: { (_) in self.setIconImage(&layer, styleValue:styleValue) },
194
+ isLayerStillValid: isValid,
195
+ setImageOnLayerLater: { (_) in applyUpdater { (layer: inout SymbolLayer) in self.setIconImage(&layer, styleValue: styleValue) } },
196
+ name: "Symbol.\(prop)"
197
+ )
237
198
  } else if (prop == "iconRotate") {
238
199
  self.setIconRotate(&layer, styleValue:styleValue);
239
200
  } else if (prop == "iconPadding") {
@@ -350,7 +311,7 @@ func symbolLayer(layer: inout SymbolLayer, reactStyle:Dictionary<String, Any>, a
350
311
  }
351
312
  }
352
313
 
353
- func circleLayer(layer: inout CircleLayer, reactStyle:Dictionary<String, Any>, applyUpdater: @escaping ((inout CircleLayer)->Void)->Void, isValid: @escaping () -> Bool)
314
+ func circleLayer(layer: inout CircleLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout CircleLayer)->Void)->Void, isValid: @escaping () -> Bool)
354
315
  {
355
316
  guard self._hasReactStyle(reactStyle) else {
356
317
  Logger.log(level:.error, message: "Invalid style: \(reactStyle)")
@@ -413,7 +374,7 @@ func circleLayer(layer: inout CircleLayer, reactStyle:Dictionary<String, Any>, a
413
374
  }
414
375
  }
415
376
 
416
- func heatmapLayer(layer: inout HeatmapLayer, reactStyle:Dictionary<String, Any>, applyUpdater: @escaping ((inout HeatmapLayer)->Void)->Void, isValid: @escaping () -> Bool)
377
+ func heatmapLayer(layer: inout HeatmapLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout HeatmapLayer)->Void)->Void, isValid: @escaping () -> Bool)
417
378
  {
418
379
  guard self._hasReactStyle(reactStyle) else {
419
380
  Logger.log(level:.error, message: "Invalid style: \(reactStyle)")
@@ -452,7 +413,7 @@ func heatmapLayer(layer: inout HeatmapLayer, reactStyle:Dictionary<String, Any>,
452
413
  }
453
414
  }
454
415
 
455
- func fillExtrusionLayer(layer: inout FillExtrusionLayer, reactStyle:Dictionary<String, Any>, applyUpdater: @escaping ((inout FillExtrusionLayer)->Void)->Void, isValid: @escaping () -> Bool)
416
+ func fillExtrusionLayer(layer: inout FillExtrusionLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout FillExtrusionLayer)->Void)->Void, isValid: @escaping () -> Bool)
456
417
  {
457
418
  guard self._hasReactStyle(reactStyle) else {
458
419
  Logger.log(level:.error, message: "Invalid style: \(reactStyle)")
@@ -484,28 +445,15 @@ func fillExtrusionLayer(layer: inout FillExtrusionLayer, reactStyle:Dictionary<S
484
445
  } else if (prop == "fillExtrusionTranslateAnchor") {
485
446
  self.setFillExtrusionTranslateAnchor(&layer, styleValue:styleValue);
486
447
  } else if (prop == "fillExtrusionPattern") {
487
- if (!styleValue.shouldAddImage()) {
488
- self.setFillExtrusionPattern(&layer, styleValue:styleValue);
489
- } else {
490
- let imageURI = styleValue.getImageURI()
491
-
492
- RCTMGLUtils.fetchImage(bridge!, url:imageURI, scale:styleValue.getImageScale(), callback:{ (error, image) in
493
- if let image = image {
494
- DispatchQueue.main.sync {
495
- if (isValid()) {
496
- logged("FillExtrusion.FillExtrusionPattern.addImage") {
497
- try self.style.addImage(image, id:imageURI!, stretchX: [], stretchY: []);
498
- applyUpdater { (layer: inout FillExtrusionLayer) in
499
- self.setFillExtrusionPattern(&layer, styleValue:styleValue);
500
- }
501
- }
502
- }
503
- }
504
- } else {
505
- Logger.log(level: .error, message: "Error during fetchImage: \(optional: error)")
506
- }
507
- });
508
- }
448
+ styleValue.setImage(
449
+ bridge: bridge!,
450
+ style: style,
451
+ oldValue: oldReactStyle?[prop],
452
+ setImageOnLayer: { (_) in self.setFillExtrusionPattern(&layer, styleValue:styleValue) },
453
+ isLayerStillValid: isValid,
454
+ setImageOnLayerLater: { (_) in applyUpdater { (layer: inout FillExtrusionLayer) in self.setFillExtrusionPattern(&layer, styleValue: styleValue) } },
455
+ name: "FillExtrusion.\(prop)"
456
+ )
509
457
  } else if (prop == "fillExtrusionHeight") {
510
458
  self.setFillExtrusionHeight(&layer, styleValue:styleValue);
511
459
  } else if (prop == "fillExtrusionHeightTransition") {
@@ -522,7 +470,7 @@ func fillExtrusionLayer(layer: inout FillExtrusionLayer, reactStyle:Dictionary<S
522
470
  }
523
471
  }
524
472
 
525
- func rasterLayer(layer: inout RasterLayer, reactStyle:Dictionary<String, Any>, applyUpdater: @escaping ((inout RasterLayer)->Void)->Void, isValid: @escaping () -> Bool)
473
+ func rasterLayer(layer: inout RasterLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout RasterLayer)->Void)->Void, isValid: @escaping () -> Bool)
526
474
  {
527
475
  guard self._hasReactStyle(reactStyle) else {
528
476
  Logger.log(level:.error, message: "Invalid style: \(reactStyle)")
@@ -573,7 +521,7 @@ func rasterLayer(layer: inout RasterLayer, reactStyle:Dictionary<String, Any>, a
573
521
  }
574
522
  }
575
523
 
576
- func hillshadeLayer(layer: inout HillshadeLayer, reactStyle:Dictionary<String, Any>, applyUpdater: @escaping ((inout HillshadeLayer)->Void)->Void, isValid: @escaping () -> Bool)
524
+ func hillshadeLayer(layer: inout HillshadeLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout HillshadeLayer)->Void)->Void, isValid: @escaping () -> Bool)
577
525
  {
578
526
  guard self._hasReactStyle(reactStyle) else {
579
527
  Logger.log(level:.error, message: "Invalid style: \(reactStyle)")
@@ -616,7 +564,7 @@ func hillshadeLayer(layer: inout HillshadeLayer, reactStyle:Dictionary<String, A
616
564
  }
617
565
  }
618
566
 
619
- func backgroundLayer(layer: inout BackgroundLayer, reactStyle:Dictionary<String, Any>, applyUpdater: @escaping ((inout BackgroundLayer)->Void)->Void, isValid: @escaping () -> Bool)
567
+ func backgroundLayer(layer: inout BackgroundLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout BackgroundLayer)->Void)->Void, isValid: @escaping () -> Bool)
620
568
  {
621
569
  guard self._hasReactStyle(reactStyle) else {
622
570
  Logger.log(level:.error, message: "Invalid style: \(reactStyle)")
@@ -638,28 +586,15 @@ func backgroundLayer(layer: inout BackgroundLayer, reactStyle:Dictionary<String,
638
586
  } else if (prop == "backgroundColorTransition") {
639
587
  self.setBackgroundColorTransition(&layer, styleValue:styleValue);
640
588
  } else if (prop == "backgroundPattern") {
641
- if (!styleValue.shouldAddImage()) {
642
- self.setBackgroundPattern(&layer, styleValue:styleValue);
643
- } else {
644
- let imageURI = styleValue.getImageURI()
645
-
646
- RCTMGLUtils.fetchImage(bridge!, url:imageURI, scale:styleValue.getImageScale(), callback:{ (error, image) in
647
- if let image = image {
648
- DispatchQueue.main.sync {
649
- if (isValid()) {
650
- logged("Background.BackgroundPattern.addImage") {
651
- try self.style.addImage(image, id:imageURI!, stretchX: [], stretchY: []);
652
- applyUpdater { (layer: inout BackgroundLayer) in
653
- self.setBackgroundPattern(&layer, styleValue:styleValue);
654
- }
655
- }
656
- }
657
- }
658
- } else {
659
- Logger.log(level: .error, message: "Error during fetchImage: \(optional: error)")
660
- }
661
- });
662
- }
589
+ styleValue.setImage(
590
+ bridge: bridge!,
591
+ style: style,
592
+ oldValue: oldReactStyle?[prop],
593
+ setImageOnLayer: { (_) in self.setBackgroundPattern(&layer, styleValue:styleValue) },
594
+ isLayerStillValid: isValid,
595
+ setImageOnLayerLater: { (_) in applyUpdater { (layer: inout BackgroundLayer) in self.setBackgroundPattern(&layer, styleValue: styleValue) } },
596
+ name: "Background.\(prop)"
597
+ )
663
598
  } else if (prop == "backgroundOpacity") {
664
599
  self.setBackgroundOpacity(&layer, styleValue:styleValue);
665
600
  } else if (prop == "backgroundOpacityTransition") {
@@ -670,7 +605,7 @@ func backgroundLayer(layer: inout BackgroundLayer, reactStyle:Dictionary<String,
670
605
  }
671
606
  }
672
607
 
673
- func skyLayer(layer: inout SkyLayer, reactStyle:Dictionary<String, Any>, applyUpdater: @escaping ((inout SkyLayer)->Void)->Void, isValid: @escaping () -> Bool)
608
+ func skyLayer(layer: inout SkyLayer, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout SkyLayer)->Void)->Void, isValid: @escaping () -> Bool)
674
609
  {
675
610
  guard self._hasReactStyle(reactStyle) else {
676
611
  Logger.log(level:.error, message: "Invalid style: \(reactStyle)")
@@ -713,7 +648,7 @@ func skyLayer(layer: inout SkyLayer, reactStyle:Dictionary<String, Any>, applyUp
713
648
  }
714
649
  }
715
650
 
716
- func lightLayer(layer: inout Light, reactStyle:Dictionary<String, Any>, applyUpdater: @escaping ((inout Light)->Void)->Void, isValid: @escaping () -> Bool)
651
+ func lightLayer(layer: inout Light, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout Light)->Void)->Void, isValid: @escaping () -> Bool)
717
652
  {
718
653
  guard self._hasReactStyle(reactStyle) else {
719
654
  Logger.log(level:.error, message: "Invalid style: \(reactStyle)")
@@ -748,7 +683,7 @@ func lightLayer(layer: inout Light, reactStyle:Dictionary<String, Any>, applyUpd
748
683
  }
749
684
  }
750
685
 
751
- func atmosphereLayer(layer: inout Atmosphere, reactStyle:Dictionary<String, Any>, applyUpdater: @escaping ((inout Atmosphere)->Void)->Void, isValid: @escaping () -> Bool)
686
+ func atmosphereLayer(layer: inout Atmosphere, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout Atmosphere)->Void)->Void, isValid: @escaping () -> Bool)
752
687
  {
753
688
  guard self._hasReactStyle(reactStyle) else {
754
689
  Logger.log(level:.error, message: "Invalid style: \(reactStyle)")
@@ -793,7 +728,7 @@ func atmosphereLayer(layer: inout Atmosphere, reactStyle:Dictionary<String, Any>
793
728
  }
794
729
  }
795
730
 
796
- func terrainLayer(layer: inout Terrain, reactStyle:Dictionary<String, Any>, applyUpdater: @escaping ((inout Terrain)->Void)->Void, isValid: @escaping () -> Bool)
731
+ func terrainLayer(layer: inout Terrain, reactStyle:Dictionary<String, Any>, oldReactStyle:Dictionary<String, Any>?, applyUpdater: @escaping ((inout Terrain)->Void)->Void, isValid: @escaping () -> Bool)
797
732
  {
798
733
  guard self._hasReactStyle(reactStyle) else {
799
734
  Logger.log(level:.error, message: "Invalid style: \(reactStyle)")
@@ -398,13 +398,59 @@ class RCTMGLStyleValue {
398
398
  return false
399
399
  }
400
400
 
401
+ func setImage(
402
+ bridge: RCTBridge,
403
+ style: Style,
404
+ oldValue: Any?,
405
+ setImageOnLayer: (_: RCTMGLStyleValue) -> Void,
406
+ isLayerStillValid: @escaping () -> Bool, // check if layer/map still valid in case we try to set the image after downloaded
407
+ setImageOnLayerLater: @escaping (_: RCTMGLStyleValue) -> Void, // called in case we need to set the image later just after downloaded
408
+ name: String
409
+ ) {
410
+ if (!shouldAddImage()) {
411
+ setImageOnLayer(self)
412
+ } else {
413
+ let imageURI = getImageURI()
414
+
415
+ if let oldRawValue = oldValue as? [String:Any] {
416
+ if let oldRawValue = oldRawValue["stylevalue"] as? [String:Any] {
417
+ if let oldValue = parse(rawStyleValue: oldRawValue) as? [String:Any] {
418
+ if getImageURI(oldValue) == imageURI {
419
+ setImageOnLayer(self)
420
+ return
421
+ }
422
+ }
423
+ }
424
+ }
425
+
426
+ RCTMGLUtils.fetchImage(bridge, url:imageURI, scale:getImageScale(), callback:{ (error, image) in
427
+ if let image = image {
428
+ DispatchQueue.main.sync {
429
+ if (isLayerStillValid()) {
430
+ logged("\(name).addImage") {
431
+ try style.addImage(image, id:imageURI!, stretchX: [], stretchY: []);
432
+ setImageOnLayerLater(self)
433
+ }
434
+ }
435
+ }
436
+ } else {
437
+ Logger.log(level: .error, message: "Error during fetchImage: \(optional: error)")
438
+ }
439
+ });
440
+ }
441
+ }
442
+
443
+ func getImageURI(_ dict: [String:Any]) -> String? {
444
+ if let uri = dict["uri"] as? String {
445
+ return uri
446
+ } else {
447
+ return nil
448
+ }
449
+ }
450
+
401
451
  func getImageURI() -> String? {
402
452
  if let dict = styleObject as? [String:Any] {
403
- if let uri = dict["uri"] as? String {
404
- return uri
405
- } else {
406
- return nil
407
- }
453
+ return getImageURI(dict)
408
454
  } else if let uri = styleObject as? String {
409
455
  return uri
410
456
  }
@@ -35,6 +35,7 @@ class RCTMGLSymbolLayer: RCTMGLVectorLayer {
35
35
  styler.symbolLayer(
36
36
  layer: &styleLayer,
37
37
  reactStyle: reactStyle,
38
+ oldReactStyle: oldReatStyle,
38
39
  applyUpdater: { (updater) in logged("RCTMGLSymbolLayer.updateLayer") {
39
40
  try style.updateLayer(withId: self.id, type: LayerType.self) { (layer: inout LayerType) in updater(&layer) }
40
41
  }},
@@ -73,6 +73,7 @@ class RCTMGLTerrain : RCTMGLSingletonLayer, RCTMGLMapComponent, RCTMGLSourceCons
73
73
  styler.terrainLayer(
74
74
  layer: &terrain,
75
75
  reactStyle: reactStyle,
76
+ oldReactStyle: oldReactStyle,
76
77
  applyUpdater: { (updater) in fatalError("Terrain: TODO - implement apply updater")},
77
78
  isValid: { fatalError("Terrain: TODO - no isValid") }
78
79
  )
package/ios/install.md CHANGED
@@ -60,7 +60,7 @@ You can also override the version to use. *Warning:* if you set a version, then
60
60
 
61
61
  ```ruby
62
62
  # Warning: only for advanced use cases, only do this if you know what you're doing.
63
- # $RNMapboxMapsVersion = '~> 10.11.0'
63
+ # $RNMapboxMapsVersion = '~> 10.12.0'
64
64
  ```
65
65
 
66
66
  You will need to authorize your download of the Maps SDK with a secret access token with the `DOWNLOADS:READ` scope. This [guide](https://docs.mapbox.com/ios/maps/guides/install/#configure-credentials) explains how to configure the secret token under section `Configure your secret token`.
@@ -122,16 +122,18 @@ export type CameraStop = {
122
122
  };
123
123
 
124
124
  export type CameraFollowConfig = {
125
- /** The mode used to track the user location on the map. */
126
- followUserMode?: UserTrackingMode;
127
125
  /** Whether the map orientation follows the user location. */
128
126
  followUserLocation?: boolean;
127
+ /** The mode used to track the user location on the map. */
128
+ followUserMode?: UserTrackingMode;
129
129
  /** The zoom level used when following the user location. */
130
130
  followZoomLevel?: number;
131
131
  /** The pitch used when following the user location. */
132
132
  followPitch?: number;
133
133
  /** The heading used when following the user location. */
134
134
  followHeading?: number;
135
+ /** The padding used to position the user location when following. */
136
+ followPadding?: Partial<CameraPadding>;
135
137
  };
136
138
 
137
139
  export type CameraMinMaxConfig = {
@@ -232,6 +234,7 @@ export const Camera = memo(
232
234
  followZoomLevel,
233
235
  followPitch,
234
236
  followHeading,
237
+ followPadding,
235
238
  defaultSettings,
236
239
  allowUpdates = true,
237
240
  onUserTrackingModeChange,
@@ -526,9 +529,10 @@ export const Camera = memo(
526
529
  defaultStop={nativeDefaultStop}
527
530
  followUserLocation={followUserLocation}
528
531
  followUserMode={followUserMode}
532
+ followZoomLevel={followZoomLevel}
529
533
  followPitch={followPitch}
530
534
  followHeading={followHeading}
531
- followZoomLevel={followZoomLevel}
535
+ followPadding={followPadding}
532
536
  minZoomLevel={minZoomLevel}
533
537
  maxZoomLevel={maxZoomLevel}
534
538
  maxBounds={nativeMaxBounds}
@@ -0,0 +1,133 @@
1
+ import React from 'react';
2
+ import { requireNativeComponent, Image } from 'react-native';
3
+ import { ImageSourcePropType, ImageResolvedAssetSource } from 'react-native';
4
+
5
+ import { ShapeSource } from './ShapeSource';
6
+
7
+ export const NATIVE_MODULE_NAME = 'RCTMGLImages';
8
+
9
+ export type RNMBEvent<PayloadType = { [key: string]: string }> = {
10
+ payload: PayloadType;
11
+ type: string;
12
+ };
13
+
14
+ function _isUrlOrPath(value: string | ImageSourcePropType): value is string {
15
+ return (
16
+ (typeof value === 'string' || value instanceof String) &&
17
+ (value.startsWith('file://') ||
18
+ value.startsWith('http://') ||
19
+ value.startsWith('https://') ||
20
+ value.startsWith('data:') ||
21
+ value.startsWith('asset://') ||
22
+ value.startsWith('/'))
23
+ );
24
+ }
25
+
26
+ type NativeImage =
27
+ | string
28
+ | {
29
+ name: string;
30
+ sdf?: boolean;
31
+ strechX: [number, number][];
32
+ streacY: [number, number][];
33
+ };
34
+
35
+ interface Props {
36
+ /**
37
+ * Specifies the external images in key-value pairs required for the shape source.
38
+ * Keys are names - see iconImage expressions, values can be either urls-s objects
39
+ * with format {uri: 'http://...'}` or `require('image.png')` or `import 'image.png'`
40
+ */
41
+ images?: { [key: string]: ImageSourcePropType };
42
+
43
+ /**
44
+ * If you have an asset under Image.xcassets on iOS and the drawables directory on android
45
+ * you can specify an array of string names with assets as the key `['pin']`.
46
+ * Additionally object with keys sdf, and strechX, strechY is supported for [SDF icons](https://docs.mapbox.com/help/troubleshooting/using-recolorable-images-in-mapbox-maps/)
47
+ */
48
+ nativeAssetImages?: NativeImage[];
49
+
50
+ /**
51
+ * Gets called when a Layer is trying to render an image whose key is not present in
52
+ * any of the `Images` component of the Map.
53
+ */
54
+ onImageMissing?: (imageKey: string) => void;
55
+
56
+ id?: string;
57
+ children?: React.ReactElement;
58
+ }
59
+
60
+ /**
61
+ * Images defines the images used in Symbol etc. layers.
62
+ */
63
+ class Images extends React.Component<Props> {
64
+ static NATIVE_ASSETS_KEY = 'assets';
65
+
66
+ _getImages() {
67
+ if (!this.props.images && !this.props.nativeAssetImages) {
68
+ return {};
69
+ }
70
+
71
+ const images: { [key: string]: string | ImageResolvedAssetSource } = {};
72
+ let nativeImages: NativeImage[] = [];
73
+
74
+ if (this.props.images) {
75
+ const imageNames = Object.keys(this.props.images);
76
+ for (const imageName of imageNames) {
77
+ const value = this.props.images[imageName];
78
+ if (
79
+ imageName === ShapeSource.NATIVE_ASSETS_KEY &&
80
+ Array.isArray(value)
81
+ ) {
82
+ console.error(
83
+ `Use of ${ShapeSource.NATIVE_ASSETS_KEY} in Images#images is not supported use Images#nativeAssetImages`,
84
+ );
85
+ } else if (_isUrlOrPath(value)) {
86
+ images[imageName] = value;
87
+ } else {
88
+ const res = Image.resolveAssetSource(value);
89
+ if (res && res.uri) {
90
+ images[imageName] = res;
91
+ }
92
+ }
93
+ }
94
+ }
95
+
96
+ if (this.props.nativeAssetImages) {
97
+ nativeImages = this.props.nativeAssetImages;
98
+ }
99
+
100
+ return {
101
+ images,
102
+ nativeImages,
103
+ };
104
+ }
105
+
106
+ _onImageMissing(event: React.SyntheticEvent<Element, RNMBEvent>) {
107
+ if (this.props.onImageMissing) {
108
+ this.props.onImageMissing(event.nativeEvent.payload.imageKey);
109
+ }
110
+ }
111
+
112
+ render() {
113
+ const props = {
114
+ id: this.props.id,
115
+ hasOnImageMissing: !!this.props.onImageMissing,
116
+ onImageMissing: this._onImageMissing.bind(this),
117
+ ...this._getImages(),
118
+ };
119
+
120
+ return <RCTMGLImages {...props}>{this.props.children}</RCTMGLImages>;
121
+ }
122
+ }
123
+
124
+ type NativeProps = {
125
+ hasOnImageMissing: boolean;
126
+ onImageMissing?: (event: React.SyntheticEvent<Element, RNMBEvent>) => void;
127
+ images?: { [key: string]: string | ImageResolvedAssetSource };
128
+ nativeImages?: NativeImage[];
129
+ };
130
+
131
+ const RCTMGLImages = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
132
+
133
+ export default Images;
@@ -248,10 +248,15 @@ class MapView extends NativeBridgeComponent(
248
248
  onDidFinishLoadingMap: PropTypes.func,
249
249
 
250
250
  /**
251
- * This event is triggered when the map has failed to load a new map style.
251
+ * This event is triggered when the map has failed to load a new map style. On v10 it's deprecated and replaced by onMapLoadingError
252
252
  */
253
253
  onDidFailLoadingMap: PropTypes.func,
254
254
 
255
+ /**
256
+ * This event is tiggered when there is an error during map load. V10 only, replaces onDidFailLoadingMap, might be called multiple times and not exclusive with onDidFinishLoadingMap.
257
+ */
258
+ onMapLoadingError: PropTypes.func,
259
+
255
260
  /**
256
261
  * This event is triggered when the map will start rendering a frame.
257
262
  */
@@ -372,7 +377,13 @@ class MapView extends NativeBridgeComponent(
372
377
  function addIfHasHandler(name) {
373
378
  if (props[`on${name}`] != null) {
374
379
  if (MapboxGL.EventTypes[name] == null) {
375
- console.warn(`rnmapbox maps: ${name} is not supported`);
380
+ if (name === 'DidFailLoadingMap') {
381
+ console.warn(
382
+ `rnmapbox maps: on${name} is deprecated, please use onMapLoadingError`,
383
+ );
384
+ } else {
385
+ console.warn(`rnmapbox maps: ${name} is not supported`);
386
+ }
376
387
  } else {
377
388
  events.push(MapboxGL.EventTypes[name]);
378
389
  return true;
@@ -387,6 +398,7 @@ class MapView extends NativeBridgeComponent(
387
398
  addIfHasHandler('UserLocationUpdate');
388
399
  addIfHasHandler('WillStartLoadingMap');
389
400
  addIfHasHandler('DidFinishLoadingMap');
401
+ addIfHasHandler('MapLoadingError');
390
402
  addIfHasHandler('DidFailLoadingMap');
391
403
  addIfHasHandler('WillStartRenderingFrame');
392
404
  addIfHasHandler('DidFinishRenderingFrame');
@@ -700,6 +712,7 @@ class MapView extends NativeBridgeComponent(
700
712
  this.props;
701
713
  const { type, payload } = e.nativeEvent;
702
714
  let propName = '';
715
+ let deprecatedPropName = '';
703
716
 
704
717
  switch (type) {
705
718
  case MapboxGL.EventTypes.RegionWillChange:
@@ -737,6 +750,10 @@ class MapView extends NativeBridgeComponent(
737
750
  case MapboxGL.EventTypes.DidFailLoadingMap:
738
751
  propName = 'onDidFailLoadingMap';
739
752
  break;
753
+ case MapboxGL.EventTypes.MapLoadingError:
754
+ propName = 'onMapLoadingError';
755
+ deprecatedPropName = 'onDidFailLoadingMap';
756
+ break;
740
757
  case MapboxGL.EventTypes.WillStartRenderingFrame:
741
758
  propName = 'onWillStartRenderingFrame';
742
759
  break;
@@ -765,6 +782,9 @@ class MapView extends NativeBridgeComponent(
765
782
  if (propName.length) {
766
783
  this._handleOnChange(propName, payload);
767
784
  }
785
+ if (deprecatedPropName.length) {
786
+ this._handleOnChange(deprecatedPropName, payload);
787
+ }
768
788
  }
769
789
 
770
790
  _onLayout(e) {