@rnmapbox/maps 10.0.0-beta.75 → 10.0.0-beta.77

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 (298) hide show
  1. package/README.md +3 -3
  2. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImagesManager.kt +5 -5
  3. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyle.kt +7 -1
  4. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +5 -5
  5. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTLayer.kt +37 -10
  6. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLBackgroundLayer.kt +21 -0
  7. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLBackgroundLayerManager.kt +65 -0
  8. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLCircleLayer.kt +40 -0
  9. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLCircleLayerManager.kt +76 -0
  10. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillExtrusionLayer.kt +43 -0
  11. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillExtrusionLayerManager.kt +76 -0
  12. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillLayer.kt +40 -0
  13. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillLayerManager.kt +76 -0
  14. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLHeatmapLayer.kt +40 -0
  15. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLHeatmapLayerManager.kt +76 -0
  16. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLLineLayer.kt +40 -0
  17. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLLineLayerManager.kt +76 -0
  18. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLRasterLayer.kt +18 -0
  19. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLRasterLayerManager.kt +65 -0
  20. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSkyLayerManager.kt +76 -0
  21. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSymbolLayer.kt +40 -0
  22. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSymbolLayerManager.kt +76 -0
  23. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLImageSource.kt +69 -0
  24. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLImageSourceManager.kt +54 -0
  25. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterDemSource.kt +82 -0
  26. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterDemSourceManager.kt +30 -0
  27. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterSource.kt +37 -0
  28. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterSourceManager.kt +32 -0
  29. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLShapeSource.kt +5 -0
  30. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLShapeSourceManager.kt +10 -4
  31. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLTileSource.kt +44 -0
  32. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLTileSourceManager.kt +69 -0
  33. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSource.kt +78 -0
  34. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSourceManager.kt +69 -0
  35. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTSource.kt +101 -85
  36. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/events/PointAnnotationDragEvent.java +4 -2
  37. package/ios/RCTMGL-v10/RCMTGLImage.swift +2 -1
  38. package/ios/RCTMGL-v10/RCTMGLCamera.swift +11 -31
  39. package/ios/RCTMGL-v10/RCTMGLImages.swift +57 -17
  40. package/ios/RCTMGL-v10/RCTMGLInteractiveElement.swift +13 -1
  41. package/ios/RCTMGL-v10/RCTMGLLayer.swift +35 -6
  42. package/ios/RCTMGL-v10/RCTMGLLocationModule.swift +27 -4
  43. package/ios/RCTMGL-v10/RCTMGLMapView.swift +15 -3
  44. package/ios/RCTMGL-v10/RCTMGLSource.swift +35 -17
  45. package/ios/RCTMGL-v10/RCTMGLUtils.swift +14 -5
  46. package/javascript/MGLModule.ts +54 -0
  47. package/javascript/Mapbox.ts +100 -0
  48. package/javascript/classes/index.d.ts +20 -1
  49. package/javascript/components/AbstractLayer.tsx +2 -1
  50. package/javascript/components/Annotation.tsx +141 -0
  51. package/javascript/components/BackgroundLayer.tsx +6 -1
  52. package/javascript/components/{Callout.js → Callout.tsx} +53 -45
  53. package/javascript/components/CircleLayer.tsx +5 -0
  54. package/javascript/components/FillExtrusionLayer.tsx +6 -1
  55. package/javascript/components/FillLayer.tsx +5 -0
  56. package/javascript/components/HeadingIndicator.tsx +24 -13
  57. package/javascript/components/HeatmapLayer.tsx +6 -1
  58. package/javascript/components/ImageSource.tsx +6 -1
  59. package/javascript/components/Images.tsx +58 -6
  60. package/javascript/components/LineLayer.tsx +5 -0
  61. package/javascript/components/MapView.tsx +1 -1
  62. package/javascript/components/MarkerView.tsx +3 -2
  63. package/javascript/components/PointAnnotation.tsx +11 -6
  64. package/javascript/components/RasterDemSource.tsx +5 -0
  65. package/javascript/components/RasterLayer.tsx +6 -1
  66. package/javascript/components/RasterSource.tsx +5 -0
  67. package/javascript/components/ShapeSource.tsx +6 -1
  68. package/javascript/components/SkyLayer.tsx +5 -0
  69. package/javascript/components/{Style.js → Style.tsx} +117 -35
  70. package/javascript/components/SymbolLayer.tsx +6 -1
  71. package/javascript/components/Terrain.tsx +8 -7
  72. package/javascript/components/{UserLocation.js → UserLocation.tsx} +106 -95
  73. package/javascript/components/VectorSource.tsx +6 -1
  74. package/javascript/index.ts +4 -0
  75. package/javascript/modules/offline/offlineManager.ts +5 -1
  76. package/javascript/modules/snapshot/snapshotManager.ts +1 -0
  77. package/javascript/types/BaseProps.ts +1 -0
  78. package/javascript/types/Position.ts +1 -0
  79. package/javascript/utils/Logger.ts +1 -1
  80. package/javascript/utils/geoUtils.ts +0 -35
  81. package/javascript/utils/index.ts +0 -8
  82. package/javascript/utils/styleMap.ts +0 -1598
  83. package/lib/commonjs/MGLModule.js +37 -0
  84. package/lib/commonjs/MGLModule.js.map +1 -0
  85. package/lib/commonjs/Mapbox.js +379 -0
  86. package/lib/commonjs/Mapbox.js.map +1 -0
  87. package/lib/commonjs/classes/index.d.js +2 -0
  88. package/lib/commonjs/classes/index.d.js.map +1 -1
  89. package/lib/commonjs/components/AbstractLayer.js +1 -2
  90. package/lib/commonjs/components/AbstractLayer.js.map +1 -1
  91. package/lib/commonjs/components/{annotations/Annotation.js → Annotation.js} +26 -27
  92. package/lib/commonjs/components/Annotation.js.map +1 -0
  93. package/lib/commonjs/components/BackgroundLayer.js.map +1 -1
  94. package/lib/commonjs/components/Callout.js +7 -33
  95. package/lib/commonjs/components/Callout.js.map +1 -1
  96. package/lib/commonjs/components/CircleLayer.js.map +1 -1
  97. package/lib/commonjs/components/FillExtrusionLayer.js.map +1 -1
  98. package/lib/commonjs/components/FillLayer.js.map +1 -1
  99. package/lib/commonjs/components/HeadingIndicator.js +12 -3
  100. package/lib/commonjs/components/HeadingIndicator.js.map +1 -1
  101. package/lib/commonjs/components/HeatmapLayer.js.map +1 -1
  102. package/lib/commonjs/components/ImageSource.js.map +1 -1
  103. package/lib/commonjs/components/Images.js +17 -1
  104. package/lib/commonjs/components/Images.js.map +1 -1
  105. package/lib/commonjs/components/LineLayer.js.map +1 -1
  106. package/lib/commonjs/components/MapView.js.map +1 -1
  107. package/lib/commonjs/components/MarkerView.js.map +1 -1
  108. package/lib/commonjs/components/PointAnnotation.js.map +1 -1
  109. package/lib/commonjs/components/RasterDemSource.js.map +1 -1
  110. package/lib/commonjs/components/RasterLayer.js.map +1 -1
  111. package/lib/commonjs/components/RasterSource.js.map +1 -1
  112. package/lib/commonjs/components/ShapeSource.js.map +1 -1
  113. package/lib/commonjs/components/SkyLayer.js.map +1 -1
  114. package/lib/commonjs/components/Style.js +11 -15
  115. package/lib/commonjs/components/Style.js.map +1 -1
  116. package/lib/commonjs/components/SymbolLayer.js.map +1 -1
  117. package/lib/commonjs/components/Terrain.js.map +1 -1
  118. package/lib/commonjs/components/UserLocation.js +28 -78
  119. package/lib/commonjs/components/UserLocation.js.map +1 -1
  120. package/lib/commonjs/components/VectorSource.js.map +1 -1
  121. package/lib/commonjs/index.js +16 -339
  122. package/lib/commonjs/index.js.map +1 -1
  123. package/lib/commonjs/modules/offline/offlineManager.js +6 -0
  124. package/lib/commonjs/modules/offline/offlineManager.js.map +1 -1
  125. package/lib/commonjs/modules/snapshot/snapshotManager.js.map +1 -1
  126. package/lib/commonjs/types/Position.js +2 -0
  127. package/lib/commonjs/types/Position.js.map +1 -0
  128. package/lib/commonjs/utils/animated/Animated.js.map +1 -1
  129. package/lib/commonjs/utils/geoUtils.js +1 -19
  130. package/lib/commonjs/utils/geoUtils.js.map +1 -1
  131. package/lib/commonjs/utils/index.js +0 -16
  132. package/lib/commonjs/utils/index.js.map +1 -1
  133. package/lib/commonjs/utils/styleMap.js +1 -1217
  134. package/lib/commonjs/utils/styleMap.js.map +1 -1
  135. package/lib/module/MGLModule.js +19 -0
  136. package/lib/module/MGLModule.js.map +1 -0
  137. package/lib/module/Mapbox.js +59 -0
  138. package/lib/module/Mapbox.js.map +1 -0
  139. package/lib/module/classes/index.d.js +2 -0
  140. package/lib/module/classes/index.d.js.map +1 -1
  141. package/lib/module/components/AbstractLayer.js +1 -1
  142. package/lib/module/components/AbstractLayer.js.map +1 -1
  143. package/lib/module/components/{annotations/Annotation.js → Annotation.js} +26 -27
  144. package/lib/module/components/Annotation.js.map +1 -0
  145. package/lib/module/components/BackgroundLayer.js.map +1 -1
  146. package/lib/module/components/Callout.js +7 -33
  147. package/lib/module/components/Callout.js.map +1 -1
  148. package/lib/module/components/CircleLayer.js.map +1 -1
  149. package/lib/module/components/FillExtrusionLayer.js.map +1 -1
  150. package/lib/module/components/FillLayer.js.map +1 -1
  151. package/lib/module/components/HeadingIndicator.js +12 -3
  152. package/lib/module/components/HeadingIndicator.js.map +1 -1
  153. package/lib/module/components/HeatmapLayer.js.map +1 -1
  154. package/lib/module/components/ImageSource.js.map +1 -1
  155. package/lib/module/components/Images.js +17 -1
  156. package/lib/module/components/Images.js.map +1 -1
  157. package/lib/module/components/LineLayer.js.map +1 -1
  158. package/lib/module/components/MapView.js.map +1 -1
  159. package/lib/module/components/MarkerView.js.map +1 -1
  160. package/lib/module/components/PointAnnotation.js.map +1 -1
  161. package/lib/module/components/RasterDemSource.js.map +1 -1
  162. package/lib/module/components/RasterLayer.js.map +1 -1
  163. package/lib/module/components/RasterSource.js.map +1 -1
  164. package/lib/module/components/ShapeSource.js.map +1 -1
  165. package/lib/module/components/SkyLayer.js.map +1 -1
  166. package/lib/module/components/Style.js +11 -15
  167. package/lib/module/components/Style.js.map +1 -1
  168. package/lib/module/components/SymbolLayer.js.map +1 -1
  169. package/lib/module/components/Terrain.js.map +1 -1
  170. package/lib/module/components/UserLocation.js +27 -77
  171. package/lib/module/components/UserLocation.js.map +1 -1
  172. package/lib/module/components/VectorSource.js.map +1 -1
  173. package/lib/module/index.js +3 -108
  174. package/lib/module/index.js.map +1 -1
  175. package/lib/module/modules/offline/offlineManager.js +1 -0
  176. package/lib/module/modules/offline/offlineManager.js.map +1 -1
  177. package/lib/module/modules/snapshot/snapshotManager.js.map +1 -1
  178. package/lib/module/types/Position.js +2 -0
  179. package/lib/module/types/Position.js.map +1 -0
  180. package/lib/module/utils/animated/Animated.js.map +1 -1
  181. package/lib/module/utils/geoUtils.js +0 -16
  182. package/lib/module/utils/geoUtils.js.map +1 -1
  183. package/lib/module/utils/index.js +0 -14
  184. package/lib/module/utils/index.js.map +1 -1
  185. package/lib/module/utils/styleMap.js +0 -1201
  186. package/lib/module/utils/styleMap.js.map +1 -1
  187. package/lib/typescript/MGLModule.d.ts +22 -0
  188. package/lib/typescript/MGLModule.d.ts.map +1 -0
  189. package/lib/typescript/Mapbox.d.ts +54 -0
  190. package/lib/typescript/Mapbox.d.ts.map +1 -0
  191. package/lib/typescript/components/AbstractLayer.d.ts +1 -0
  192. package/lib/typescript/components/AbstractLayer.d.ts.map +1 -1
  193. package/lib/typescript/components/Annotation.d.ts +34 -0
  194. package/lib/typescript/components/Annotation.d.ts.map +1 -0
  195. package/lib/typescript/components/BackgroundLayer.d.ts +5 -1
  196. package/lib/typescript/components/BackgroundLayer.d.ts.map +1 -1
  197. package/lib/typescript/components/Callout.d.ts +41 -0
  198. package/lib/typescript/components/Callout.d.ts.map +1 -0
  199. package/lib/typescript/components/CircleLayer.d.ts +4 -0
  200. package/lib/typescript/components/CircleLayer.d.ts.map +1 -1
  201. package/lib/typescript/components/FillExtrusionLayer.d.ts +5 -1
  202. package/lib/typescript/components/FillExtrusionLayer.d.ts.map +1 -1
  203. package/lib/typescript/components/FillLayer.d.ts +4 -0
  204. package/lib/typescript/components/FillLayer.d.ts.map +1 -1
  205. package/lib/typescript/components/HeadingIndicator.d.ts +2 -1
  206. package/lib/typescript/components/HeadingIndicator.d.ts.map +1 -1
  207. package/lib/typescript/components/HeatmapLayer.d.ts +5 -1
  208. package/lib/typescript/components/HeatmapLayer.d.ts.map +1 -1
  209. package/lib/typescript/components/ImageSource.d.ts +5 -1
  210. package/lib/typescript/components/ImageSource.d.ts.map +1 -1
  211. package/lib/typescript/components/Images.d.ts +24 -2
  212. package/lib/typescript/components/Images.d.ts.map +1 -1
  213. package/lib/typescript/components/LineLayer.d.ts +4 -0
  214. package/lib/typescript/components/LineLayer.d.ts.map +1 -1
  215. package/lib/typescript/components/MapView.d.ts +2 -5
  216. package/lib/typescript/components/MapView.d.ts.map +1 -1
  217. package/lib/typescript/components/MarkerView.d.ts +3 -2
  218. package/lib/typescript/components/MarkerView.d.ts.map +1 -1
  219. package/lib/typescript/components/PointAnnotation.d.ts +8 -6
  220. package/lib/typescript/components/PointAnnotation.d.ts.map +1 -1
  221. package/lib/typescript/components/RasterDemSource.d.ts +4 -0
  222. package/lib/typescript/components/RasterDemSource.d.ts.map +1 -1
  223. package/lib/typescript/components/RasterLayer.d.ts +5 -1
  224. package/lib/typescript/components/RasterLayer.d.ts.map +1 -1
  225. package/lib/typescript/components/RasterSource.d.ts +4 -0
  226. package/lib/typescript/components/RasterSource.d.ts.map +1 -1
  227. package/lib/typescript/components/ShapeSource.d.ts +5 -1
  228. package/lib/typescript/components/ShapeSource.d.ts.map +1 -1
  229. package/lib/typescript/components/SkyLayer.d.ts +4 -0
  230. package/lib/typescript/components/SkyLayer.d.ts.map +1 -1
  231. package/lib/typescript/components/Style.d.ts +74 -0
  232. package/lib/typescript/components/Style.d.ts.map +1 -0
  233. package/lib/typescript/components/SymbolLayer.d.ts +5 -1
  234. package/lib/typescript/components/SymbolLayer.d.ts.map +1 -1
  235. package/lib/typescript/components/Terrain.d.ts +2 -2
  236. package/lib/typescript/components/Terrain.d.ts.map +1 -1
  237. package/lib/typescript/components/UserLocation.d.ts +102 -0
  238. package/lib/typescript/components/UserLocation.d.ts.map +1 -0
  239. package/lib/typescript/components/VectorSource.d.ts +5 -1
  240. package/lib/typescript/components/VectorSource.d.ts.map +1 -1
  241. package/lib/typescript/index.d.ts +4 -0
  242. package/lib/typescript/index.d.ts.map +1 -0
  243. package/lib/typescript/modules/offline/offlineManager.d.ts +2 -1
  244. package/lib/typescript/modules/offline/offlineManager.d.ts.map +1 -1
  245. package/lib/typescript/modules/snapshot/snapshotManager.d.ts +1 -0
  246. package/lib/typescript/modules/snapshot/snapshotManager.d.ts.map +1 -1
  247. package/lib/typescript/types/BaseProps.d.ts +1 -0
  248. package/lib/typescript/types/BaseProps.d.ts.map +1 -1
  249. package/lib/typescript/types/Position.d.ts +2 -0
  250. package/lib/typescript/types/Position.d.ts.map +1 -0
  251. package/lib/typescript/utils/Logger.d.ts +1 -1
  252. package/lib/typescript/utils/Logger.d.ts.map +1 -1
  253. package/lib/typescript/utils/animated/Animated.d.ts +23 -0
  254. package/lib/typescript/utils/animated/Animated.d.ts.map +1 -0
  255. package/lib/typescript/utils/geoUtils.d.ts +0 -8
  256. package/lib/typescript/utils/geoUtils.d.ts.map +1 -1
  257. package/lib/typescript/utils/index.d.ts +0 -14
  258. package/lib/typescript/utils/index.d.ts.map +1 -1
  259. package/lib/typescript/utils/styleMap.d.ts +0 -1406
  260. package/lib/typescript/utils/styleMap.d.ts.map +1 -1
  261. package/package.json +35 -39
  262. package/plugin/build/withMapbox.d.ts +10 -6
  263. package/plugin/build/withMapbox.js +119 -137
  264. package/plugin/install.md +21 -0
  265. package/plugin/src/withMapbox.ts +166 -138
  266. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLBackgroundLayer.java +0 -23
  267. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLBackgroundLayerManager.java +0 -60
  268. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLCircleLayer.java +0 -53
  269. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLCircleLayerManager.java +0 -73
  270. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillExtrusionLayer.java +0 -51
  271. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillExtrusionLayerManager.java +0 -76
  272. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillLayer.java +0 -51
  273. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLFillLayerManager.java +0 -77
  274. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLHeatmapLayer.java +0 -51
  275. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLHeatmapLayerManager.java +0 -73
  276. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLLineLayer.java +0 -51
  277. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLLineLayerManager.java +0 -75
  278. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLRasterLayer.java +0 -24
  279. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLRasterLayerManager.java +0 -60
  280. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSkyLayerManager.java +0 -73
  281. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSymbolLayer.java +0 -51
  282. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTMGLSymbolLayerManager.java +0 -71
  283. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLImageSource.java +0 -76
  284. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLImageSourceManager.java +0 -68
  285. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterDemSource.java +0 -122
  286. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterDemSourceManager.java +0 -64
  287. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterSource.java +0 -43
  288. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLRasterSourceManager.java +0 -39
  289. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLTileSource.java +0 -103
  290. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLTileSourceManager.java +0 -80
  291. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSource.java +0 -100
  292. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSourceManager.java +0 -80
  293. package/index.d.ts +0 -516
  294. package/javascript/components/annotations/Annotation.js +0 -122
  295. package/javascript/index.js +0 -162
  296. package/lib/commonjs/components/annotations/Annotation.js.map +0 -1
  297. package/lib/module/components/annotations/Annotation.js.map +0 -1
  298. /package/javascript/utils/animated/{Animated.js → Animated.ts} +0 -0
@@ -61,6 +61,9 @@ class RCTMGLLocationManager : LocationProviderDelegate {
61
61
  var simulatedHeading: Double = 0.0
62
62
  var simulatedHeadingIncrement: Double = 1.0
63
63
 
64
+ var startUpdatingLocationCalled = false
65
+ var startUpdatingHeadingCalled = false
66
+
64
67
  init() {
65
68
  provider = AppleLocationProvider()
66
69
  provider.setDelegate(self)
@@ -87,9 +90,19 @@ class RCTMGLLocationManager : LocationProviderDelegate {
87
90
  }
88
91
 
89
92
  func stop() {
90
- provider.stopUpdatingHeading()
91
- provider.stopUpdatingLocation()
92
- provider.setDelegate(EmptyLocationProviderDelegate())
93
+ if !startUpdatingHeadingCalled {
94
+ provider.stopUpdatingHeading()
95
+ }
96
+ if !startUpdatingLocationCalled {
97
+ provider.stopUpdatingLocation()
98
+ }
99
+ _clearProviderDelegateIfNotListening()
100
+ }
101
+
102
+ func _clearProviderDelegateIfNotListening() {
103
+ if !startUpdatingHeadingCalled && !startUpdatingLocationCalled {
104
+ provider.setDelegate(EmptyLocationProviderDelegate())
105
+ }
93
106
  }
94
107
 
95
108
  func _convertToMapboxLocation(_ location: CLLocation?, type: LocationUpdateType) -> RCTMGLLocation {
@@ -144,6 +157,8 @@ class RCTMGLLocationManager : LocationProviderDelegate {
144
157
  }
145
158
  }
146
159
 
160
+ // MARK: LocationProvider
161
+
147
162
  extension RCTMGLLocationManager: LocationProvider {
148
163
  var locationProviderOptions: LocationOptions {
149
164
  get {
@@ -194,11 +209,15 @@ extension RCTMGLLocationManager: LocationProvider {
194
209
  }
195
210
 
196
211
  func startUpdatingLocation() {
212
+ startUpdatingLocationCalled = true
197
213
  provider.startUpdatingLocation()
198
214
  }
199
215
 
200
216
  func stopUpdatingLocation() {
201
217
  provider.stopUpdatingLocation()
218
+ startUpdatingLocationCalled = false
219
+
220
+ _clearProviderDelegateIfNotListening()
202
221
  }
203
222
 
204
223
  var headingOrientation: CLDeviceOrientation {
@@ -211,11 +230,15 @@ extension RCTMGLLocationManager: LocationProvider {
211
230
  }
212
231
 
213
232
  func startUpdatingHeading() {
233
+ startUpdatingHeadingCalled = true
214
234
  provider.startUpdatingHeading()
215
235
  }
216
236
 
217
237
  func stopUpdatingHeading() {
238
+ startUpdatingHeadingCalled = false
218
239
  provider.stopUpdatingHeading()
240
+
241
+ _clearProviderDelegateIfNotListening()
219
242
  }
220
243
 
221
244
  func dismissHeadingCalibrationDisplay() {
@@ -276,7 +299,7 @@ extension RCTMGLLocationManager {
276
299
  class RCTMGLLocationModule: RCTEventEmitter, RCTMGLLocationManagerDelegate {
277
300
 
278
301
  static weak var shared : RCTMGLLocationModule? = nil
279
-
302
+
280
303
  var locationManager : RCTMGLLocationManager
281
304
  var hasListener = false
282
305
 
@@ -645,7 +645,17 @@ extension RCTMGLMapView: GestureManagerDelegate {
645
645
  }
646
646
 
647
647
  func highestZIndex(sources: [RCTMGLInteractiveElement]) -> RCTMGLInteractiveElement? {
648
- return sources.first
648
+ var layersToSource : [String:RCTMGLInteractiveElement] = [:]
649
+
650
+ sources.forEach { source in
651
+ source.getLayerIDs().forEach { layerId in
652
+ if layersToSource[layerId] == nil {
653
+ layersToSource[layerId] = source
654
+ }
655
+ }
656
+ }
657
+ let orderedLayers = mapboxMap.style.allLayerIdentifiers
658
+ return orderedLayers.lazy.reversed().compactMap { layersToSource[$0.id] }.first ?? sources.first
649
659
  }
650
660
 
651
661
  @objc
@@ -849,7 +859,8 @@ class PointAnnotationManager : AnnotationInteractionDelegate {
849
859
  if let pt = rctmglPointAnnotation.object {
850
860
  let position = pt.superview?.convert(pt.layer.position, to: nil)
851
861
  let location = pt.map?.mapboxMap.coordinate(for: position!)
852
- var geojson = Feature(geometry: .point(Point(location!)));
862
+ var geojson = Feature(geometry: .point(Point(location!)))
863
+ geojson.identifier = .string(pt.id)
853
864
  geojson.properties = [
854
865
  "screenPointX": .number(Double(position!.x)),
855
866
  "screenPointY": .number(Double(position!.y))
@@ -937,7 +948,8 @@ class PointAnnotationManager : AnnotationInteractionDelegate {
937
948
  if let rctmglPointAnnotation = userInfo[RCTMGLPointAnnotation.key] as? WeakRef<RCTMGLPointAnnotation> {
938
949
  if let pt = rctmglPointAnnotation.object {
939
950
  let position = pt.superview?.convert(pt.layer.position, to: nil)
940
- var geojson = Feature(geometry: .point(Point(targetPoint)));
951
+ var geojson = Feature(geometry: .point(Point(targetPoint)))
952
+ geojson.identifier = .string(pt.id)
941
953
  geojson.properties = [
942
954
  "screenPointX": .number(Double(position!.x)),
943
955
  "screenPointY": .number(Double(position!.y))
@@ -3,6 +3,7 @@
3
3
  @objc
4
4
  class RCTMGLSource : RCTMGLInteractiveElement {
5
5
  var layers: [RCTMGLSourceConsumer] = []
6
+ var components: [RCTMGLMapComponent] = []
6
7
 
7
8
  var source : Source? = nil
8
9
 
@@ -29,16 +30,32 @@ class RCTMGLSource : RCTMGLInteractiveElement {
29
30
  // MARK: - UIView+React
30
31
 
31
32
  @objc override func insertReactSubview(_ subview: UIView!, at atIndex: Int) {
32
- if let layer : RCTMGLSourceConsumer = subview as? RCTMGLSourceConsumer {
33
+ if let layer = subview as? RCTMGLSourceConsumer {
33
34
  if let map = map {
34
35
  layer.addToMap(map, style: map.mapboxMap.style)
35
36
  }
36
37
  layers.append(layer)
38
+ } else if let component = subview as? RCTMGLMapComponent {
39
+ if let map = map {
40
+ component.addToMap(map, style: map.mapboxMap.style)
41
+ }
42
+ components.append(component)
37
43
  }
38
44
  super.insertReactSubview(subview, at: atIndex)
39
45
  }
40
46
 
41
47
  @objc override func removeReactSubview(_ subview: UIView!) {
48
+ if let layer : RCTMGLSourceConsumer = subview as? RCTMGLSourceConsumer {
49
+ if let map = map {
50
+ layer.removeFromMap(map, style: map.mapboxMap.style)
51
+ }
52
+ layers.removeAll { $0 as AnyObject === layer }
53
+ } else if let component = subview as? RCTMGLMapComponent {
54
+ if let map = map {
55
+ component.removeFromMap(map)
56
+ }
57
+ layers.removeAll { $0 as AnyObject === component }
58
+ }
42
59
  super.removeReactSubview(subview)
43
60
  }
44
61
 
@@ -50,28 +67,29 @@ class RCTMGLSource : RCTMGLInteractiveElement {
50
67
 
51
68
  override func addToMap(_ map: RCTMGLMapView, style: Style) {
52
69
  self.map = map
53
-
54
- map.onMapStyleLoaded { mapboxMap in
55
- if style.sourceExists(withId: self.id) {
56
- self.source = try! style.source(withId: self.id)
57
- } else {
58
- let source = self.makeSource()
59
- self.ownsSource = true
60
- self.source = source
61
- logged("SyleSource.addToMap", info: {"id: \(optional: self.id)"}) {
62
- try style.addSource(source, id: self.id)
63
- }
64
- }
65
-
66
- for layer in self.layers {
67
- layer.addToMap(map, style: map.mapboxMap.style)
70
+
71
+ if style.sourceExists(withId: self.id) {
72
+ self.source = try! style.source(withId: self.id)
73
+ } else {
74
+ let source = self.makeSource()
75
+ self.ownsSource = true
76
+ self.source = source
77
+ logged("SyleSource.addToMap", info: {"id: \(optional: self.id)"}) {
78
+ try style.addSource(source, id: self.id)
68
79
  }
69
80
  }
81
+
82
+ for layer in self.layers {
83
+ layer.addToMap(map, style: map.mapboxMap.style)
84
+ }
85
+ for component in self.components {
86
+ component.addToMap(map, style: map.mapboxMap.style)
87
+ }
70
88
  }
71
89
 
72
90
  override func removeFromMap(_ map: RCTMGLMapView) {
73
91
  self.map = nil
74
-
92
+
75
93
  for layer in self.layers {
76
94
  layer.removeFromMap(map, style: map.mapboxMap.style)
77
95
  }
@@ -30,9 +30,15 @@ class RCTMGLUtils {
30
30
  if (forceUpdate || foundImage == nil) {
31
31
  let image = objects[imageName]
32
32
  if let image = image as? [String:Any] {
33
- let hasScale = image["scale"] != nil
34
- let scale = hasScale ? (image["scale"] as! NSNumber).doubleValue : 1.0
35
- RCTMGLImageQueue.sharedInstance.addImage(objects[imageName], scale: scale, bridge:bridge) {
33
+ let scale = (image["scale"] as? NSNumber)?.floatValue ?? 1.0
34
+ let sdf = (image["sdf"] as? NSNumber)?.boolValue ?? false
35
+ let imageStretchX = image["stretchX"] as? [[NSNumber]]
36
+ let stretchX: [ImageStretches] = imageStretchX != nil ? RCTMGLImages.convert(stretch: imageStretchX!, scale: scale) : []
37
+ let imageStretchY = image["stretchY"] as? [[NSNumber]]
38
+ let stretchY: [ImageStretches] = imageStretchY != nil ? RCTMGLImages.convert(stretch: imageStretchY!, scale: scale) : []
39
+ let content: ImageContent? = RCTMGLImages.convert(content: image["content"] as? [NSNumber], scale: scale)
40
+
41
+ RCTMGLImageQueue.sharedInstance.addImage(objects[imageName], scale: Double(scale), bridge:bridge) {
36
42
  (error,image) in
37
43
  if image == nil {
38
44
  RCTMGLLogWarn("Failed to fetch image: \(imageName) error:\(error)")
@@ -40,8 +46,11 @@ class RCTMGLUtils {
40
46
  else {
41
47
  DispatchQueue.main.async {
42
48
  if let image = image {
43
- try! style.addImage(image, id: imageName, stretchX: [], stretchY: [])
44
- imageLoadedBlock()
49
+ logged("RCTMGLUtils.fetchImage-\(imageName)") {
50
+ print("width=\(image.size.width) height=\(image.size.height) scale=\(image.scale) scale2=\(scale)")
51
+ try style.addImage(image, id: imageName, sdf:sdf, stretchX: stretchX, stretchY: stretchY, content: content)
52
+ imageLoadedBlock()
53
+ }
45
54
  }
46
55
  }
47
56
  }
@@ -0,0 +1,54 @@
1
+ import { NativeModules } from 'react-native';
2
+
3
+ interface MGLModule {
4
+ StyleURL: {
5
+ Street: URL;
6
+ Outdoors: URL;
7
+ Light: URL;
8
+ Dark: URL;
9
+ Satellite: URL;
10
+ SatelliteStreet: URL;
11
+ };
12
+ OfflinePackDownloadState: {
13
+ Inactive: string | number;
14
+ Active: string | number;
15
+ Complete: string | number;
16
+ Unknown?: string | number;
17
+ };
18
+ LineJoin: {
19
+ Bevel: string | number;
20
+ Round: string | number;
21
+ Miter: string | number;
22
+ };
23
+ StyleSource: {
24
+ DefaultSourceID: string;
25
+ };
26
+ TileServers: {
27
+ Mapbox: string;
28
+ };
29
+
30
+ removeCustomHeader(headerName: string): void;
31
+ addCustomHeader(headerName: string, headerValue: string): void;
32
+ setAccessToken(accessToken: string | null): Promise<string | null>;
33
+ setWellKnownTileServer(tileServer: string): void;
34
+ getAccessToken(): Promise<string>;
35
+ setTelemetryEnabled(telemetryEnabled: boolean): void;
36
+ setConnected(connected: boolean): void;
37
+ }
38
+
39
+ const MGLModule: MGLModule = { ...NativeModules.MGLModule };
40
+
41
+ export const {
42
+ StyleURL,
43
+ OfflinePackDownloadState,
44
+ LineJoin,
45
+ StyleSource,
46
+ TileServers,
47
+ removeCustomHeader,
48
+ addCustomHeader,
49
+ setAccessToken,
50
+ setWellKnownTileServer,
51
+ getAccessToken,
52
+ setTelemetryEnabled,
53
+ setConnected,
54
+ } = MGLModule;
@@ -0,0 +1,100 @@
1
+ export * from './MGLModule';
2
+ export {
3
+ Camera,
4
+ UserTrackingMode,
5
+ type CameraPadding,
6
+ type CameraAnimationMode,
7
+ type CameraBounds,
8
+ } from './components/Camera';
9
+ export { Atmosphere } from './components/Atmosphere';
10
+ export { default as MapView, type MapState } from './components/MapView';
11
+ export { default as Light } from './components/Light';
12
+ export { default as PointAnnotation } from './components/PointAnnotation';
13
+ export { default as Annotation } from './components/Annotation';
14
+ export { default as Callout } from './components/Callout';
15
+ export {
16
+ default as UserLocation,
17
+ UserLocationRenderMode,
18
+ } from './components/UserLocation';
19
+ export { default as VectorSource } from './components/VectorSource';
20
+ export { ShapeSource } from './components/ShapeSource';
21
+ export { default as RasterSource } from './components/RasterSource';
22
+ export { default as RasterDemSource } from './components/RasterDemSource';
23
+ export { default as ImageSource } from './components/ImageSource';
24
+ export { default as Images, type ImageEntry } from './components/Images';
25
+ export { default as Image } from './components/Image';
26
+ export { default as FillLayer } from './components/FillLayer';
27
+ export { default as FillExtrusionLayer } from './components/FillExtrusionLayer';
28
+ export { default as HeatmapLayer } from './components/HeatmapLayer';
29
+ export { default as LineLayer } from './components/LineLayer';
30
+ export { default as CircleLayer } from './components/CircleLayer';
31
+ export { default as SkyLayer } from './components/SkyLayer';
32
+ export { SymbolLayer } from './components/SymbolLayer';
33
+ export { default as RasterLayer } from './components/RasterLayer';
34
+ export { default as BackgroundLayer } from './components/BackgroundLayer';
35
+ export { Terrain } from './components/Terrain';
36
+ export {
37
+ default as locationManager,
38
+ type Location,
39
+ } from './modules/location/locationManager';
40
+ export {
41
+ default as offlineManager,
42
+ OfflineCreatePackOptions,
43
+ } from './modules/offline/offlineManager';
44
+ export {
45
+ default as snapshotManager,
46
+ type SnapshotOptions,
47
+ } from './modules/snapshot/snapshotManager';
48
+ export { default as MarkerView } from './components/MarkerView';
49
+ export { default as Animated } from './utils/animated/Animated';
50
+ export {
51
+ AnimatedCoordinatesArray,
52
+ AnimatedExtractCoordinateFromArray,
53
+ AnimatedPoint,
54
+ AnimatedRouteCoordinatesArray,
55
+ AnimatedShape,
56
+ } from './classes';
57
+ export { default as Style } from './components/Style';
58
+ export { default as Logger, type LogLevel } from './utils/Logger';
59
+ export { requestAndroidLocationPermissions } from './requestAndroidLocationPermissions';
60
+ export { getAnnotationsLayerID } from './utils/getAnnotationsLayerID';
61
+ export type {
62
+ FillLayerStyleProps as FillLayerStyle,
63
+ LineLayerStyleProps as LineLayerStyle,
64
+ SymbolLayerStyleProps as SymbolLayerStyle,
65
+ CircleLayerStyleProps as CircleLayerStyle,
66
+ HeatmapLayerStyleProps as HeatmapLayerStyle,
67
+ FillExtrusionLayerStyleProps as FillExtrusionLayerStyle,
68
+ RasterLayerStyleProps as RasterLayerStyle,
69
+ HillshadeLayerStyleProps as HillshadeLayerStyle,
70
+ BackgroundLayerStyleProps as BackgroundLayerStyle,
71
+ SkyLayerStyleProps as SkyLayerStyle,
72
+ LightLayerStyleProps as LightLayerStyle,
73
+ AtmosphereLayerStyleProps as AtmosphereLayerStyle,
74
+ TerrainLayerStyleProps as TerrainLayerStyle,
75
+ } from './utils/MapboxStyles';
76
+
77
+ import { deprecatedClass } from './utils/deprecation';
78
+ import { AnimatedPoint } from './classes';
79
+ import { UserTrackingMode } from './components/Camera';
80
+
81
+ /** @deprecated This will be removed in a future release. Use `AnimatedPoint` instead. */
82
+ export const AnimatedMapPoint = deprecatedClass(
83
+ AnimatedPoint,
84
+ 'AnimatedMapPoint is deprecated please use AnimatedPoint',
85
+ );
86
+
87
+ // types:
88
+ export enum StyleURL {
89
+ Street = 'mapbox://styles/mapbox/streets-v11',
90
+ Dark = 'mapbox://styles/mapbox/dark-v10',
91
+ Light = 'mapbox://styles/mapbox/light-v10',
92
+ Outdoors = 'mapbox://styles/mapbox/outdoors-v11',
93
+ Satellite = 'mapbox://styles/mapbox/satellite-v9',
94
+ SatelliteStreet = 'mapbox://styles/mapbox/satellite-streets-v11',
95
+ TrafficDay = 'mapbox://styles/mapbox/navigation-preview-day-v4',
96
+ TrafficNight = 'mapbox://styles/mapbox/navigation-preview-night-v4',
97
+ }
98
+
99
+ /** @deprecated UserTrackingModes is deprecated use UserTrackingMode */
100
+ export const UserTrackingModes = UserTrackingMode;
@@ -1,5 +1,24 @@
1
+ import { Point } from 'geojson';
2
+ import { Animated } from 'react-native';
3
+
4
+ import WithAnimatedObject = Animated.WithAnimatedObject;
5
+
1
6
  export class AnimatedCoordinatesArray {}
2
7
  export class AnimatedExtractCoordinateFromArray {}
3
- export class AnimatedPoint {}
8
+ export class AnimatedPoint implements WithAnimatedObject<Point> {
9
+ constructor(point: Point);
10
+
11
+ timing({
12
+ coordinates,
13
+ easing,
14
+ duration,
15
+ }: {
16
+ coordinates: number[];
17
+ easing?: (x: number) => number;
18
+ duration?: number;
19
+ });
20
+
21
+ stopAnimation();
22
+ }
4
23
  export class AnimatedRouteCoordinatesArray {}
5
24
  export class AnimatedShape {}
@@ -1,4 +1,3 @@
1
- /* eslint react/prop-types:0 */
2
1
  import React from 'react';
3
2
  import { NativeMethods, processColor } from 'react-native';
4
3
 
@@ -9,6 +8,7 @@ import type { BaseProps } from '../types/BaseProps';
9
8
 
10
9
  type PropsBase = BaseProps & {
11
10
  id: string;
11
+ existing?: boolean;
12
12
  sourceID?: string;
13
13
  minZoomLevel?: number;
14
14
  maxZoomLevel?: number;
@@ -27,6 +27,7 @@ class AbstractLayer<
27
27
  return {
28
28
  ...this.props,
29
29
  id: this.props.id,
30
+ existing: this.props.existing,
30
31
  sourceID: this.props.sourceID,
31
32
  reactStyle: this.getStyle(this.props.style),
32
33
  minZoomLevel: this.props.minZoomLevel,
@@ -0,0 +1,141 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { Animated as RNAnimated, Easing } from 'react-native';
3
+ import { Point } from 'geojson';
4
+
5
+ import Animated from '../utils/animated/Animated';
6
+ import { AnimatedPoint } from '../classes';
7
+ import { OnPressEvent } from '../types/OnPressEvent';
8
+ import { SymbolLayerStyle } from '../Mapbox';
9
+
10
+ import { SymbolLayer } from './SymbolLayer';
11
+
12
+ type Props = {
13
+ id: string;
14
+ animated?: boolean;
15
+ animationDuration?: number;
16
+ animationEasingFunction?: (x: number) => number;
17
+ coordinates: number[];
18
+ onPress?: (event: OnPressEvent) => void;
19
+ children: ReactElement | ReactElement[];
20
+ style?: object;
21
+ icon?: string | number | object;
22
+ };
23
+
24
+ type AnnotationState = {
25
+ shape: Point | AnimatedPoint | null;
26
+ };
27
+
28
+ class Annotation extends React.Component<Props, AnnotationState> {
29
+ static defaultProps = {
30
+ animated: false,
31
+ animationDuration: 1000,
32
+ animationEasingFunction: Easing.linear,
33
+ };
34
+
35
+ constructor(props: Props) {
36
+ super(props);
37
+
38
+ const shape = this._getShapeFromProps(props);
39
+
40
+ this.state = {
41
+ shape: props.animated ? new AnimatedPoint(shape) : shape,
42
+ };
43
+
44
+ this.onPress = this.onPress.bind(this);
45
+ }
46
+
47
+ componentDidUpdate(prevProps: Props) {
48
+ if (!Array.isArray(this.props.coordinates)) {
49
+ this.setState({ shape: null });
50
+ return;
51
+ }
52
+
53
+ const haveCoordinatesChanged =
54
+ prevProps.coordinates[0] !== this.props.coordinates[0] ||
55
+ prevProps.coordinates[1] !== this.props.coordinates[1];
56
+
57
+ if (
58
+ prevProps.animated !== this.props.animated ||
59
+ (haveCoordinatesChanged && (!this.state.shape || !this.props.animated))
60
+ ) {
61
+ const shape = this._getShapeFromProps(this.props);
62
+
63
+ this.setState({
64
+ shape: this.props.animated ? new AnimatedPoint(shape) : shape,
65
+ });
66
+ } else if (
67
+ haveCoordinatesChanged &&
68
+ this.props.animated &&
69
+ this.state.shape
70
+ ) {
71
+ // flush current animations
72
+ (this.state.shape as AnimatedPoint).stopAnimation();
73
+
74
+ (this.state.shape as AnimatedPoint)
75
+ .timing({
76
+ coordinates: this.props.coordinates,
77
+ easing: this.props.animationEasingFunction,
78
+ duration: this.props.animationDuration,
79
+ })
80
+ .start();
81
+ }
82
+ }
83
+
84
+ onPress(event: OnPressEvent) {
85
+ if (this.props.onPress) {
86
+ this.props.onPress(event);
87
+ }
88
+ }
89
+
90
+ _getShapeFromProps(props: Partial<Props> = {}): Point {
91
+ const lng = props.coordinates?.[0] || 0;
92
+ const lat = props.coordinates?.[1] || 0;
93
+ return { type: 'Point', coordinates: [lng, lat] };
94
+ }
95
+
96
+ get symbolStyle(): SymbolLayerStyle | undefined {
97
+ if (!this.props.icon) {
98
+ return undefined;
99
+ }
100
+ return Object.assign({}, this.props.style, {
101
+ iconImage: this.props.icon,
102
+ });
103
+ }
104
+
105
+ render() {
106
+ if (!this.props.coordinates) {
107
+ return null;
108
+ }
109
+
110
+ const children = [];
111
+
112
+ if (this.symbolStyle) {
113
+ children.push(
114
+ <SymbolLayer
115
+ id={`${this.props.id}-symbol`}
116
+ style={this.symbolStyle as SymbolLayerStyle}
117
+ />,
118
+ );
119
+ }
120
+
121
+ if (this.props.children) {
122
+ if (Array.isArray(this.props.children)) {
123
+ children.push(...this.props.children);
124
+ } else {
125
+ children.push(this.props.children);
126
+ }
127
+ }
128
+
129
+ return (
130
+ <Animated.ShapeSource
131
+ id={this.props.id}
132
+ onPress={this.onPress}
133
+ shape={this.state.shape as RNAnimated.WithAnimatedObject<Point>}
134
+ >
135
+ {children}
136
+ </Animated.ShapeSource>
137
+ );
138
+ }
139
+ }
140
+
141
+ export default Annotation;
@@ -13,10 +13,15 @@ const MapboxGL = NativeModules.MGLModule;
13
13
 
14
14
  export type Props = {
15
15
  /**
16
- * A string that uniquely identifies the source in the style to which it is added.
16
+ * A string that uniquely identifies the layer in the style to which it is added.
17
17
  */
18
18
  id: string;
19
19
 
20
+ /**
21
+ * The id refers to en existing layer in the style. Does not create a new layer.
22
+ */
23
+ existing?: boolean;
24
+
20
25
  /**
21
26
  * The source from which to obtain the data to style.
22
27
  * If the source has not yet been added to the current style, the behavior is undefined.