@rnmapbox/maps 10.1.0-beta.13 → 10.1.0-beta.14

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 (175) hide show
  1. package/android/src/main/java/com/rnmapbox/rnmbx/RNMBXPackage.kt +19 -8
  2. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/NativeMapViewModule.kt +1 -1
  3. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXAndroidTextureMapViewManager.kt +1 -1
  4. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt +15 -15
  5. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapViewManager.kt +1 -1
  6. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXImageSource.kt +1 -1
  7. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSource.kt +21 -23
  8. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSourceManager.kt +0 -46
  9. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXShapeSourceModule.kt +61 -0
  10. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/{RCTSource.kt → RNMBXSource.kt} +8 -8
  11. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXTileSource.kt +1 -1
  12. package/android/src/main/java/com/rnmapbox/rnmbx/events/FeatureClickEvent.java +4 -4
  13. package/android/src/main/java/com/rnmapbox/rnmbx/utils/ViewTagResolver.kt +6 -5
  14. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXImageSourceManagerDelegate.java +41 -0
  15. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXImageSourceManagerInterface.java +20 -0
  16. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterDemSourceManagerDelegate.java +50 -0
  17. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterDemSourceManagerInterface.java +23 -0
  18. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterSourceManagerDelegate.java +56 -0
  19. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterSourceManagerInterface.java +25 -0
  20. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXShapeSourceManagerDelegate.java +77 -0
  21. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXShapeSourceManagerInterface.java +32 -0
  22. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXVectorSourceManagerDelegate.java +59 -0
  23. package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXVectorSourceManagerInterface.java +26 -0
  24. package/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeRNMBXShapeSourceModuleSpec.java +48 -0
  25. package/ios/RNMBX/RNMBXBackgroundLayerComponentView.mm +2 -0
  26. package/ios/RNMBX/RNMBXCircleLayerComponentView.mm +2 -0
  27. package/ios/RNMBX/RNMBXFillExtrusionLayerComponentView.mm +3 -1
  28. package/ios/RNMBX/RNMBXFillLayerComponentView.mm +2 -0
  29. package/ios/RNMBX/RNMBXHeatmapLayerComponentView.mm +2 -0
  30. package/ios/RNMBX/RNMBXImageSource.swift +3 -3
  31. package/ios/RNMBX/RNMBXImageSourceComponentView.h +15 -0
  32. package/ios/RNMBX/RNMBXImageSourceComponentView.mm +100 -0
  33. package/ios/RNMBX/{RNMBXImageSourceManager.m → RNMBXImageSourceViewManager.m} +1 -1
  34. package/ios/RNMBX/{RNMBXImageSourceManager.swift → RNMBXImageSourceViewManager.swift} +2 -2
  35. package/ios/RNMBX/RNMBXInteractiveElement.swift +7 -7
  36. package/ios/RNMBX/RNMBXLayer.swift +1 -1
  37. package/ios/RNMBX/RNMBXLineLayerComponentView.mm +2 -0
  38. package/ios/RNMBX/RNMBXMapFeatureView.h +7 -0
  39. package/ios/RNMBX/RNMBXRasterDemSource.swift +6 -6
  40. package/ios/RNMBX/RNMBXRasterDemSourceComponentView.h +17 -0
  41. package/ios/RNMBX/RNMBXRasterDemSourceComponentView.mm +116 -0
  42. package/ios/RNMBX/{RNMBXRasterDemSourceManager.m → RNMBXRasterDemSourceViewManager.m} +1 -7
  43. package/ios/RNMBX/{RNMBXRasterDemSourceManager.swift → RNMBXRasterDemSourceViewManager.swift} +2 -2
  44. package/ios/RNMBX/RNMBXRasterLayerComponentView.mm +2 -0
  45. package/ios/RNMBX/RNMBXRasterSource.swift +8 -8
  46. package/ios/RNMBX/RNMBXRasterSourceComponentView.h +17 -0
  47. package/ios/RNMBX/RNMBXRasterSourceComponentView.mm +124 -0
  48. package/ios/RNMBX/{RNMBXRasterSourceManager.m → RNMBXRasterSourceViewManager.m} +1 -1
  49. package/ios/RNMBX/{RNMBXRasterSourceManager.swift → RNMBXRasterSourceViewManager.swift} +2 -2
  50. package/ios/RNMBX/RNMBXShapeSource.swift +11 -11
  51. package/ios/RNMBX/RNMBXShapeSourceComponentView.h +17 -0
  52. package/ios/RNMBX/RNMBXShapeSourceComponentView.mm +153 -0
  53. package/ios/RNMBX/RNMBXShapeSourceModule.h +18 -0
  54. package/ios/RNMBX/RNMBXShapeSourceModule.mm +87 -0
  55. package/ios/RNMBX/RNMBXShapeSourceViewManager.m +26 -0
  56. package/ios/RNMBX/{RNMBXShapeSourceManager.swift → RNMBXShapeSourceViewManager.swift} +12 -42
  57. package/ios/RNMBX/RNMBXSkyLayerComponentView.mm +2 -0
  58. package/ios/RNMBX/RNMBXSource.swift +36 -27
  59. package/ios/RNMBX/RNMBXSymbolLayerComponentView.mm +2 -0
  60. package/ios/RNMBX/RNMBXTileSource.swift +2 -2
  61. package/ios/RNMBX/RNMBXVectorSource.swift +6 -6
  62. package/ios/RNMBX/RNMBXVectorSourceComponentView.h +17 -0
  63. package/ios/RNMBX/RNMBXVectorSourceComponentView.mm +141 -0
  64. package/ios/RNMBX/{RNMBXVectorSourceManager.m → RNMBXVectorSourceViewManager.m} +1 -1
  65. package/ios/RNMBX/{RNMBXVectorSourceManager.swift → RNMBXVectorSourceViewManager.swift} +2 -2
  66. package/ios/install.md +1 -0
  67. package/lib/commonjs/components/ImageSource.js +10 -7
  68. package/lib/commonjs/components/ImageSource.js.map +1 -1
  69. package/lib/commonjs/components/RasterDemSource.js +11 -8
  70. package/lib/commonjs/components/RasterDemSource.js.map +1 -1
  71. package/lib/commonjs/components/RasterSource.js +11 -8
  72. package/lib/commonjs/components/RasterSource.js.map +1 -1
  73. package/lib/commonjs/components/ShapeSource.js +31 -52
  74. package/lib/commonjs/components/ShapeSource.js.map +1 -1
  75. package/lib/commonjs/components/VectorSource.js +26 -39
  76. package/lib/commonjs/components/VectorSource.js.map +1 -1
  77. package/lib/commonjs/specs/NativeRNMBXShapeSourceModule.js +10 -0
  78. package/lib/commonjs/specs/NativeRNMBXShapeSourceModule.js.map +1 -0
  79. package/lib/commonjs/specs/RNMBXImageSourceNativeComponent.js +10 -0
  80. package/lib/commonjs/specs/RNMBXImageSourceNativeComponent.js.map +1 -0
  81. package/lib/commonjs/specs/RNMBXRasterDemSourceNativeComponent.js +10 -0
  82. package/lib/commonjs/specs/RNMBXRasterDemSourceNativeComponent.js.map +1 -0
  83. package/lib/commonjs/specs/RNMBXRasterSourceNativeComponent.js +10 -0
  84. package/lib/commonjs/specs/RNMBXRasterSourceNativeComponent.js.map +1 -0
  85. package/lib/commonjs/specs/RNMBXShapeSourceNativeComponent.js +10 -0
  86. package/lib/commonjs/specs/RNMBXShapeSourceNativeComponent.js.map +1 -0
  87. package/lib/commonjs/specs/RNMBXVectorSourceNativeComponent.js +10 -0
  88. package/lib/commonjs/specs/RNMBXVectorSourceNativeComponent.js.map +1 -0
  89. package/lib/module/components/ImageSource.js +10 -7
  90. package/lib/module/components/ImageSource.js.map +1 -1
  91. package/lib/module/components/RasterDemSource.js +11 -8
  92. package/lib/module/components/RasterDemSource.js.map +1 -1
  93. package/lib/module/components/RasterSource.js +11 -8
  94. package/lib/module/components/RasterSource.js.map +1 -1
  95. package/lib/module/components/ShapeSource.js +32 -53
  96. package/lib/module/components/ShapeSource.js.map +1 -1
  97. package/lib/module/components/VectorSource.js +28 -41
  98. package/lib/module/components/VectorSource.js.map +1 -1
  99. package/lib/module/specs/NativeRNMBXShapeSourceModule.js +5 -0
  100. package/lib/module/specs/NativeRNMBXShapeSourceModule.js.map +1 -0
  101. package/lib/module/specs/RNMBXImageSourceNativeComponent.js +3 -0
  102. package/lib/module/specs/RNMBXImageSourceNativeComponent.js.map +1 -0
  103. package/lib/module/specs/RNMBXRasterDemSourceNativeComponent.js +3 -0
  104. package/lib/module/specs/RNMBXRasterDemSourceNativeComponent.js.map +1 -0
  105. package/lib/module/specs/RNMBXRasterSourceNativeComponent.js +3 -0
  106. package/lib/module/specs/RNMBXRasterSourceNativeComponent.js.map +1 -0
  107. package/lib/module/specs/RNMBXShapeSourceNativeComponent.js +3 -0
  108. package/lib/module/specs/RNMBXShapeSourceNativeComponent.js.map +1 -0
  109. package/lib/module/specs/RNMBXVectorSourceNativeComponent.js +3 -0
  110. package/lib/module/specs/RNMBXVectorSourceNativeComponent.js.map +1 -0
  111. package/lib/typescript/src/components/ImageSource.d.ts.map +1 -1
  112. package/lib/typescript/src/components/RasterDemSource.d.ts +0 -1
  113. package/lib/typescript/src/components/RasterDemSource.d.ts.map +1 -1
  114. package/lib/typescript/src/components/RasterSource.d.ts +0 -1
  115. package/lib/typescript/src/components/RasterSource.d.ts.map +1 -1
  116. package/lib/typescript/src/components/ShapeSource.d.ts +2 -58
  117. package/lib/typescript/src/components/ShapeSource.d.ts.map +1 -1
  118. package/lib/typescript/src/components/VectorSource.d.ts +3 -64
  119. package/lib/typescript/src/components/VectorSource.d.ts.map +1 -1
  120. package/lib/typescript/src/specs/NativeRNMBXShapeSourceModule.d.ts +11 -0
  121. package/lib/typescript/src/specs/NativeRNMBXShapeSourceModule.d.ts.map +1 -0
  122. package/lib/typescript/src/specs/RNMBXImageSourceNativeComponent.d.ts +11 -0
  123. package/lib/typescript/src/specs/RNMBXImageSourceNativeComponent.d.ts.map +1 -0
  124. package/lib/typescript/src/specs/RNMBXRasterDemSourceNativeComponent.d.ts +15 -0
  125. package/lib/typescript/src/specs/RNMBXRasterDemSourceNativeComponent.d.ts.map +1 -0
  126. package/lib/typescript/src/specs/RNMBXRasterSourceNativeComponent.d.ts +17 -0
  127. package/lib/typescript/src/specs/RNMBXRasterSourceNativeComponent.d.ts.map +1 -0
  128. package/lib/typescript/src/specs/RNMBXShapeSourceNativeComponent.d.ts +29 -0
  129. package/lib/typescript/src/specs/RNMBXShapeSourceNativeComponent.d.ts.map +1 -0
  130. package/lib/typescript/src/specs/RNMBXVectorSourceNativeComponent.d.ts +23 -0
  131. package/lib/typescript/src/specs/RNMBXVectorSourceNativeComponent.d.ts.map +1 -0
  132. package/package.json +1 -1
  133. package/plugin/build/withMapbox.d.ts +5 -4
  134. package/plugin/build/withMapbox.js +46 -19
  135. package/plugin/install.md +20 -0
  136. package/plugin/src/withMapbox.ts +79 -21
  137. package/setup-jest.js +6 -0
  138. package/src/components/ImageSource.tsx +4 -6
  139. package/src/components/RasterDemSource.tsx +5 -8
  140. package/src/components/RasterSource.tsx +5 -8
  141. package/src/components/ShapeSource.tsx +39 -86
  142. package/src/components/VectorSource.tsx +20 -44
  143. package/src/specs/NativeRNMBXShapeSourceModule.ts +23 -0
  144. package/src/specs/RNMBXImageSourceNativeComponent.ts +15 -0
  145. package/src/specs/RNMBXRasterDemSourceNativeComponent.ts +19 -0
  146. package/src/specs/RNMBXRasterSourceNativeComponent.ts +21 -0
  147. package/src/specs/RNMBXShapeSourceNativeComponent.ts +35 -0
  148. package/src/specs/RNMBXVectorSourceNativeComponent.ts +28 -0
  149. package/ios/RNMBX/RNMBXShapeSourceManager.m +0 -45
  150. /package/android/src/main/mapbox-v11-compat/v10/com/{mapbox → rnmapbox}/rnmbx/v11compat/Annotation.kt +0 -0
  151. /package/android/src/main/mapbox-v11-compat/v10/com/{mapbox → rnmapbox}/rnmbx/v11compat/Event.kt +0 -0
  152. /package/android/src/main/mapbox-v11-compat/v10/com/{mapbox → rnmapbox}/rnmbx/v11compat/Feature.kt +0 -0
  153. /package/android/src/main/mapbox-v11-compat/v10/com/{mapbox → rnmapbox}/rnmbx/v11compat/HttpInterceptor.kt +0 -0
  154. /package/android/src/main/mapbox-v11-compat/v10/com/{mapbox → rnmapbox}/rnmbx/v11compat/Image.kt +0 -0
  155. /package/android/src/main/mapbox-v11-compat/v10/com/{mapbox → rnmapbox}/rnmbx/v11compat/Light.kt +0 -0
  156. /package/android/src/main/mapbox-v11-compat/v10/com/{mapbox → rnmapbox}/rnmbx/v11compat/Location.kt +0 -0
  157. /package/android/src/main/mapbox-v11-compat/v10/com/{mapbox → rnmapbox}/rnmbx/v11compat/MapboxMap.kt +0 -0
  158. /package/android/src/main/mapbox-v11-compat/v10/com/{mapbox → rnmapbox}/rnmbx/v11compat/OfflineManager.kt +0 -0
  159. /package/android/src/main/mapbox-v11-compat/v10/com/{mapbox → rnmapbox}/rnmbx/v11compat/OrnamentSettings.kt +0 -0
  160. /package/android/src/main/mapbox-v11-compat/v10/com/{mapbox → rnmapbox}/rnmbx/v11compat/ResourceOption.kt +0 -0
  161. /package/android/src/main/mapbox-v11-compat/v10/com/{mapbox → rnmapbox}/rnmbx/v11compat/Snapshot.kt +0 -0
  162. /package/android/src/main/mapbox-v11-compat/v10/com/{mapbox → rnmapbox}/rnmbx/v11compat/style.kt +0 -0
  163. /package/android/src/main/mapbox-v11-compat/v11/com/{mapbox → rnmapbox}/rnmbx/v11compat/Annotation.kt +0 -0
  164. /package/android/src/main/mapbox-v11-compat/v11/com/{mapbox → rnmapbox}/rnmbx/v11compat/Event.kt +0 -0
  165. /package/android/src/main/mapbox-v11-compat/v11/com/{mapbox → rnmapbox}/rnmbx/v11compat/Feature.kt +0 -0
  166. /package/android/src/main/mapbox-v11-compat/v11/com/{mapbox → rnmapbox}/rnmbx/v11compat/HttpInterceptor.kt +0 -0
  167. /package/android/src/main/mapbox-v11-compat/v11/com/{mapbox → rnmapbox}/rnmbx/v11compat/Image.kt +0 -0
  168. /package/android/src/main/mapbox-v11-compat/v11/com/{mapbox → rnmapbox}/rnmbx/v11compat/Light.kt +0 -0
  169. /package/android/src/main/mapbox-v11-compat/v11/com/{mapbox → rnmapbox}/rnmbx/v11compat/Location.kt +0 -0
  170. /package/android/src/main/mapbox-v11-compat/v11/com/{mapbox → rnmapbox}/rnmbx/v11compat/MapboxMap.kt +0 -0
  171. /package/android/src/main/mapbox-v11-compat/v11/com/{mapbox → rnmapbox}/rnmbx/v11compat/OfflineManager.kt +0 -0
  172. /package/android/src/main/mapbox-v11-compat/v11/com/{mapbox → rnmapbox}/rnmbx/v11compat/OrnamentSettings.kt +0 -0
  173. /package/android/src/main/mapbox-v11-compat/v11/com/{mapbox → rnmapbox}/rnmbx/v11compat/ResourceOption.kt +0 -0
  174. /package/android/src/main/mapbox-v11-compat/v11/com/{mapbox → rnmapbox}/rnmbx/v11compat/Snapshot.kt +0 -0
  175. /package/android/src/main/mapbox-v11-compat/v11/com/{mapbox → rnmapbox}/rnmbx/v11compat/style.kt +0 -0
@@ -30,14 +30,16 @@ try {
30
30
  type InstallerBlockName = 'pre' | 'post';
31
31
 
32
32
  export type MapboxPlugProps = {
33
- RNMapboxMapsImpl?: string;
34
-
35
33
  /**
36
- * @platform ios
34
+ * @deprecated
37
35
  */
36
+ RNMapboxMapsImpl?: 'mapbox';
37
+
38
38
  RNMapboxMapsVersion?: string;
39
39
 
40
40
  RNMapboxMapsDownloadToken?: string;
41
+
42
+ RNMapboxMapsUseV11?: boolean;
41
43
  };
42
44
 
43
45
  export const addInstallerBlock = (
@@ -80,11 +82,16 @@ export const addConstantBlock = (
80
82
  RNMapboxMapsImpl,
81
83
  RNMapboxMapsVersion,
82
84
  RNMapboxMapsDownloadToken,
85
+ RNMapboxMapsUseV11,
83
86
  }: MapboxPlugProps,
84
87
  ): string => {
85
88
  const tag = `@rnmapbox/maps-rnmapboxmapsimpl`;
86
89
 
87
- if (RNMapboxMapsImpl == null) {
90
+ if (
91
+ RNMapboxMapsVersion == null &&
92
+ RNMapboxMapsDownloadToken == null &&
93
+ RNMapboxMapsUseV11 == null
94
+ ) {
88
95
  const modified = removeGeneratedContents(src, tag);
89
96
  if (!modified) {
90
97
  return src;
@@ -93,15 +100,24 @@ export const addConstantBlock = (
93
100
  }
94
101
  }
95
102
 
96
- const newSrc = [
97
- `$RNMapboxMapsImpl = '${RNMapboxMapsImpl}'`,
98
- `$RNMapboxMapsDownloadToken = '${RNMapboxMapsDownloadToken}'`,
99
- ];
103
+ const newSrc = [];
104
+
105
+ if (RNMapboxMapsDownloadToken) {
106
+ newSrc.push(`$RNMapboxMapsDownloadToken = '${RNMapboxMapsDownloadToken}'`);
107
+ }
108
+
109
+ if (RNMapboxMapsImpl) {
110
+ newSrc.push(`$RNMapboxMapsImpl = '${RNMapboxMapsImpl}'`);
111
+ }
100
112
 
101
113
  if (RNMapboxMapsVersion) {
102
114
  newSrc.push(`$RNMapboxMapsVersion = '${RNMapboxMapsVersion}'`);
103
115
  }
104
116
 
117
+ if (RNMapboxMapsUseV11) {
118
+ newSrc.push(`$RNMapboxMapsUseV11 = true`);
119
+ }
120
+
105
121
  return mergeContents({
106
122
  tag,
107
123
  src,
@@ -121,6 +137,7 @@ export const applyCocoaPodsModifications = (
121
137
  RNMapboxMapsImpl,
122
138
  RNMapboxMapsVersion,
123
139
  RNMapboxMapsDownloadToken,
140
+ RNMapboxMapsUseV11,
124
141
  }: MapboxPlugProps,
125
142
  ): string => {
126
143
  // Ensure installer blocks exist
@@ -128,6 +145,7 @@ export const applyCocoaPodsModifications = (
128
145
  RNMapboxMapsImpl,
129
146
  RNMapboxMapsVersion,
130
147
  RNMapboxMapsDownloadToken,
148
+ RNMapboxMapsUseV11,
131
149
  });
132
150
  src = addInstallerBlock(src, 'pre');
133
151
  src = addInstallerBlock(src, 'post');
@@ -158,7 +176,12 @@ export const addMapboxInstallerBlock = (
158
176
  */
159
177
  const withCocoaPodsInstallerBlocks: ConfigPlugin<MapboxPlugProps> = (
160
178
  config,
161
- { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsDownloadToken },
179
+ {
180
+ RNMapboxMapsImpl,
181
+ RNMapboxMapsVersion,
182
+ RNMapboxMapsDownloadToken,
183
+ RNMapboxMapsUseV11,
184
+ },
162
185
  ) =>
163
186
  withDangerousMod(config, [
164
187
  'ios',
@@ -175,6 +198,7 @@ const withCocoaPodsInstallerBlocks: ConfigPlugin<MapboxPlugProps> = (
175
198
  RNMapboxMapsImpl,
176
199
  RNMapboxMapsVersion,
177
200
  RNMapboxMapsDownloadToken,
201
+ RNMapboxMapsUseV11,
178
202
  }),
179
203
  'utf-8',
180
204
  );
@@ -209,19 +233,32 @@ const withAndroidPropertiesDownloadToken: ConfigPlugin<MapboxPlugProps> = (
209
233
 
210
234
  const withAndroidPropertiesImpl2: ConfigPlugin<MapboxPlugProps> = (
211
235
  config,
212
- { RNMapboxMapsImpl },
236
+ { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsUseV11 },
213
237
  ) => {
214
- const key = 'expoRNMapboxMapsImpl';
215
-
216
- if (RNMapboxMapsImpl) {
238
+ const keyValues = {
239
+ expoRNMapboxMapsImpl: RNMapboxMapsImpl,
240
+ expoRNMapboxMapsVersion: RNMapboxMapsVersion,
241
+ expoRNMapboxMapsUseV11: RNMapboxMapsUseV11,
242
+ } as const;
243
+ type Keys = keyof typeof keyValues;
244
+ const keys = Object.keys(keyValues) as Keys[];
245
+ const values = Object.values(keyValues);
246
+
247
+ if (values.filter((v) => v).length > 0) {
217
248
  return withGradleProperties(config, (exportedConfig) => {
218
249
  exportedConfig.modResults = exportedConfig.modResults.filter(
219
- (item) => !(item.type === 'property' && item.key === key),
250
+ (item) =>
251
+ !(item.type === 'property' && (keys as string[]).includes(item.key)),
220
252
  );
221
- exportedConfig.modResults.push({
222
- type: 'property',
223
- key: key,
224
- value: RNMapboxMapsImpl,
253
+ keys.forEach((key) => {
254
+ const value = keyValues[key];
255
+ if (value != null) {
256
+ exportedConfig.modResults.push({
257
+ type: 'property',
258
+ key: key,
259
+ value: value.toString(),
260
+ });
261
+ }
225
262
  });
226
263
 
227
264
  return exportedConfig;
@@ -233,13 +270,20 @@ const withAndroidPropertiesImpl2: ConfigPlugin<MapboxPlugProps> = (
233
270
 
234
271
  const withAndroidProperties: ConfigPlugin<MapboxPlugProps> = (
235
272
  config,
236
- { RNMapboxMapsImpl, RNMapboxMapsDownloadToken },
273
+ {
274
+ RNMapboxMapsImpl,
275
+ RNMapboxMapsDownloadToken,
276
+ RNMapboxMapsVersion,
277
+ RNMapboxMapsUseV11,
278
+ },
237
279
  ) => {
238
280
  config = withAndroidPropertiesDownloadToken(config, {
239
281
  RNMapboxMapsDownloadToken,
240
282
  });
241
283
  config = withAndroidPropertiesImpl2(config, {
242
284
  RNMapboxMapsImpl,
285
+ RNMapboxMapsVersion,
286
+ RNMapboxMapsUseV11,
243
287
  });
244
288
 
245
289
  return config;
@@ -361,11 +405,18 @@ const withAndroidProjectGradle: ConfigPlugin<MapboxPlugProps> = (config) =>
361
405
 
362
406
  const withMapboxAndroid: ConfigPlugin<MapboxPlugProps> = (
363
407
  config,
364
- { RNMapboxMapsImpl, RNMapboxMapsDownloadToken },
408
+ {
409
+ RNMapboxMapsImpl,
410
+ RNMapboxMapsDownloadToken,
411
+ RNMapboxMapsVersion,
412
+ RNMapboxMapsUseV11,
413
+ },
365
414
  ) => {
366
415
  config = withAndroidProperties(config, {
367
416
  RNMapboxMapsImpl,
368
417
  RNMapboxMapsDownloadToken,
418
+ RNMapboxMapsVersion,
419
+ RNMapboxMapsUseV11,
369
420
  });
370
421
  config = withAndroidProjectGradle(config, { RNMapboxMapsImpl });
371
422
  config = withAndroidAppGradle(config, { RNMapboxMapsImpl });
@@ -375,17 +426,24 @@ const withMapboxAndroid: ConfigPlugin<MapboxPlugProps> = (
375
426
 
376
427
  const withMapbox: ConfigPlugin<MapboxPlugProps> = (
377
428
  config,
378
- { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsDownloadToken },
429
+ {
430
+ RNMapboxMapsImpl,
431
+ RNMapboxMapsVersion,
432
+ RNMapboxMapsDownloadToken,
433
+ RNMapboxMapsUseV11,
434
+ },
379
435
  ) => {
380
436
  config = withMapboxAndroid(config, {
381
437
  RNMapboxMapsImpl,
382
438
  RNMapboxMapsVersion,
439
+ RNMapboxMapsUseV11,
383
440
  RNMapboxMapsDownloadToken,
384
441
  });
385
442
  config = withCocoaPodsInstallerBlocks(config, {
386
443
  RNMapboxMapsImpl,
387
444
  RNMapboxMapsVersion,
388
445
  RNMapboxMapsDownloadToken,
446
+ RNMapboxMapsUseV11,
389
447
  });
390
448
 
391
449
  return config;
package/setup-jest.js CHANGED
@@ -149,6 +149,12 @@ NativeModules.RNMBXMapViewModule = {
149
149
  querySourceFeatures: jest.fn(),
150
150
  };
151
151
 
152
+ NativeModules.RNMBXShapeSourceModule = {
153
+ getClusterExpansionZoom: jest.fn(),
154
+ getClusterLeaves: jest.fn(),
155
+ getClusterChildren: jest.fn(),
156
+ };
157
+
152
158
  NativeModules.RNMBXLogging = nativeModule({});
153
159
 
154
160
  // Mock for global AbortController
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { requireNativeComponent } from 'react-native';
3
2
 
4
3
  import {
5
4
  cloneReactChildrenWithProps,
@@ -7,6 +6,7 @@ import {
7
6
  resolveImagePath,
8
7
  } from '../utils';
9
8
  import { BaseProps } from '../types/BaseProps';
9
+ import RNMBXImageSourceNativeComponent from '../specs/RNMBXImageSourceNativeComponent';
10
10
 
11
11
  import AbstractSource from './AbstractSource';
12
12
 
@@ -71,16 +71,14 @@ class ImageSource extends AbstractSource<Props, NativeProps> {
71
71
  };
72
72
 
73
73
  return (
74
- <RNMBXImageSource ref={this.setNativeRef} {...props}>
74
+ // @ts-expect-error just codegen stuff
75
+ <RNMBXImageSourceNativeComponent ref={this.setNativeRef} {...props}>
75
76
  {cloneReactChildrenWithProps(this.props.children, {
76
77
  sourceID: this.props.id,
77
78
  })}
78
- </RNMBXImageSource>
79
+ </RNMBXImageSourceNativeComponent>
79
80
  );
80
81
  }
81
82
  }
82
83
 
83
- const RNMBXImageSource =
84
- requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
85
-
86
84
  export default ImageSource;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { NativeModules, requireNativeComponent } from 'react-native';
2
+ import { NativeModules } from 'react-native';
3
3
 
4
+ import RNMBXRasterDemSourceNativeComponent from '../specs/RNMBXRasterDemSourceNativeComponent';
4
5
  import { cloneReactChildrenWithProps } from '../utils';
5
6
 
6
7
  import AbstractSource from './AbstractSource';
@@ -11,8 +12,6 @@ const isTileTemplateUrl = (url?: string): url is string =>
11
12
 
12
13
  const MapboxGL = NativeModules.RNMBXModule;
13
14
 
14
- export const NATIVE_MODULE_NAME = 'RNMBXRasterDemSource';
15
-
16
15
  type Props = {
17
16
  /**
18
17
  * A string that uniquely identifies the source.
@@ -96,16 +95,14 @@ class RasterDemSource extends AbstractSource<Props, NativeProps> {
96
95
  tileSize: this.props.tileSize,
97
96
  };
98
97
  return (
99
- <RNMBXRasterDemSource ref={this.setNativeRef} {...props}>
98
+ // @ts-expect-error just codegen stuff
99
+ <RNMBXRasterDemSourceNativeComponent ref={this.setNativeRef} {...props}>
100
100
  {cloneReactChildrenWithProps(this.props.children, {
101
101
  sourceID: this.props.id,
102
102
  })}
103
- </RNMBXRasterDemSource>
103
+ </RNMBXRasterDemSourceNativeComponent>
104
104
  );
105
105
  }
106
106
  }
107
107
 
108
- const RNMBXRasterDemSource =
109
- requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
110
-
111
108
  export default RasterDemSource;
@@ -1,15 +1,14 @@
1
1
  import React from 'react';
2
- import { NativeModules, requireNativeComponent } from 'react-native';
2
+ import { NativeModules } from 'react-native';
3
3
 
4
4
  import { cloneReactChildrenWithProps } from '../utils';
5
5
  import { BaseProps } from '../types/BaseProps';
6
+ import RNMBXRasterSourceNativeComponent from '../specs/RNMBXRasterSourceNativeComponent';
6
7
 
7
8
  import AbstractSource from './AbstractSource';
8
9
 
9
10
  const MapboxGL = NativeModules.RNMBXModule;
10
11
 
11
- export const NATIVE_MODULE_NAME = 'RNMBXRasterSource';
12
-
13
12
  const isTileTemplateUrl = (url?: string): url is string =>
14
13
  !!url &&
15
14
  (url.includes('{z}') || url.includes('{bbox-') || url.includes('{quadkey}'));
@@ -115,16 +114,14 @@ class RasterSource extends AbstractSource<Props, NativeProps> {
115
114
  attribution: this.props.attribution,
116
115
  };
117
116
  return (
118
- <RNMBXRasterSource ref={this.setNativeRef} {...props}>
117
+ // @ts-expect-error just codegen stuff
118
+ <RNMBXRasterSourceNativeComponent ref={this.setNativeRef} {...props}>
119
119
  {cloneReactChildrenWithProps(this.props.children, {
120
120
  sourceID: this.props.id,
121
121
  })}
122
- </RNMBXRasterSource>
122
+ </RNMBXRasterSourceNativeComponent>
123
123
  );
124
124
  }
125
125
  }
126
126
 
127
- const RNMBXRasterSource =
128
- requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
129
-
130
127
  export default RasterSource;
@@ -3,10 +3,11 @@ import {
3
3
  NativeMethods,
4
4
  NativeModules,
5
5
  NativeSyntheticEvent,
6
- requireNativeComponent,
6
+ findNodeHandle,
7
7
  } from 'react-native';
8
8
 
9
- import { getFilter } from '../utils/filterUtils';
9
+ import RNMBXShapeSourceNativeComponent from '../specs/RNMBXShapeSourceNativeComponent';
10
+ import NativeRNMBXShapeSourceModule from '../specs/NativeRNMBXShapeSourceModule';
10
11
  import {
11
12
  toJSONString,
12
13
  cloneReactChildrenWithProps,
@@ -17,7 +18,6 @@ import { copyPropertiesAsDeprecated } from '../utils/deprecation';
17
18
  import { OnPressEvent } from '../types/OnPressEvent';
18
19
 
19
20
  import AbstractSource from './AbstractSource';
20
- import NativeBridgeComponent from './NativeBridgeComponent';
21
21
 
22
22
  const MapboxGL = NativeModules.RNMBXModule;
23
23
 
@@ -148,10 +148,7 @@ export type Props = {
148
148
  * ShapeSource is a map content source that supplies vector shapes to be shown on the map.
149
149
  * The shape may be an url or a GeoJSON object
150
150
  */
151
- export class ShapeSource extends NativeBridgeComponent(
152
- AbstractSource<Props, NativeProps>,
153
- NATIVE_MODULE_NAME,
154
- ) {
151
+ export class ShapeSource extends AbstractSource<Props, NativeProps> {
155
152
  static NATIVE_ASSETS_KEY = 'assets';
156
153
 
157
154
  static defaultProps = {
@@ -166,31 +163,6 @@ export class ShapeSource extends NativeBridgeComponent(
166
163
  nativeRef: React.Component<NativeProps> & Readonly<NativeMethods>,
167
164
  ) {
168
165
  this.setNativeRef(nativeRef);
169
- super._runPendingNativeCommands(nativeRef);
170
- }
171
-
172
- /**
173
- * Returns all features from the source that match the query parameters whether the feature is currently
174
- * rendered on the map.
175
- *
176
- * @example
177
- * shapeSource.features()
178
- *
179
- * @param {Array=} filter - an optional filter statement to filter the returned Features.
180
- * @return {FeatureCollection}
181
- */
182
- async features(filter: Array<string> = []) {
183
- const res: { data: string } = await this._runNativeCommand(
184
- 'features',
185
- this._nativeRef,
186
- getFilter(filter),
187
- );
188
-
189
- if (isAndroid()) {
190
- return JSON.parse(res.data);
191
- }
192
-
193
- return res.data;
194
166
  }
195
167
 
196
168
  /**
@@ -209,19 +181,14 @@ export class ShapeSource extends NativeBridgeComponent(
209
181
  console.warn(
210
182
  'Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.',
211
183
  );
212
- const res: { data: number } = await this._runNativeCommand(
213
- 'getClusterExpansionZoomById',
214
- this._nativeRef,
215
- [feature],
216
- );
217
- return res.data;
218
184
  }
219
185
 
220
- const res: { data: number } = await this._runNativeCommand(
221
- 'getClusterExpansionZoom',
222
- this._nativeRef,
223
- [JSON.stringify(feature)],
224
- );
186
+ const handle = findNodeHandle(this._nativeRef as any);
187
+
188
+ const res = (await NativeRNMBXShapeSourceModule.getClusterExpansionZoom(
189
+ handle,
190
+ JSON.stringify(feature),
191
+ )) as { data: number };
225
192
  return res.data;
226
193
  }
227
194
 
@@ -245,24 +212,16 @@ export class ShapeSource extends NativeBridgeComponent(
245
212
  console.warn(
246
213
  'Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.',
247
214
  );
248
- const res: { data: string } = await this._runNativeCommand(
249
- 'getClusterLeavesById',
250
- this._nativeRef,
251
- [feature, limit, offset],
252
- );
253
-
254
- if (isAndroid()) {
255
- return JSON.parse(res.data);
256
- }
257
-
258
- return res.data;
259
215
  }
260
216
 
261
- const res: { data: string } = await this._runNativeCommand(
262
- 'getClusterLeaves',
263
- this._nativeRef,
264
- [JSON.stringify(feature), limit, offset],
265
- );
217
+ const handle = findNodeHandle(this._nativeRef as any);
218
+
219
+ const res = (await NativeRNMBXShapeSourceModule.getClusterLeaves(
220
+ handle,
221
+ JSON.stringify(feature),
222
+ limit,
223
+ offset,
224
+ )) as { data: string };
266
225
 
267
226
  if (isAndroid()) {
268
227
  return JSON.parse(res.data);
@@ -285,24 +244,14 @@ export class ShapeSource extends NativeBridgeComponent(
285
244
  console.warn(
286
245
  'Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.',
287
246
  );
288
- const res: { data: string } = await this._runNativeCommand(
289
- 'getClusterChildrenById',
290
- this._nativeRef,
291
- [feature],
292
- );
293
-
294
- if (isAndroid()) {
295
- return JSON.parse(res.data);
296
- }
297
-
298
- return res.data;
299
247
  }
300
248
 
301
- const res: { data: string } = await this._runNativeCommand(
302
- 'getClusterChildren',
303
- this._nativeRef,
304
- [JSON.stringify(feature)],
305
- );
249
+ const handle = findNodeHandle(this._nativeRef as any);
250
+
251
+ const res = (await NativeRNMBXShapeSourceModule.getClusterChildren(
252
+ handle,
253
+ JSON.stringify(feature),
254
+ )) as { data: string };
306
255
 
307
256
  if (isAndroid()) {
308
257
  return JSON.parse(res.data);
@@ -329,16 +278,23 @@ export class ShapeSource extends NativeBridgeComponent(
329
278
  return toJSONString(this.props.shape);
330
279
  }
331
280
 
281
+ _decodePayload(payload: OnPressEvent | string): OnPressEvent {
282
+ // we check whether the payload is a string, since the strict type safety is enforced only on iOS on the new arch
283
+ // on Android, on both archs, the payload is an object
284
+ if (typeof payload === 'string') {
285
+ return JSON.parse(payload);
286
+ } else {
287
+ return payload;
288
+ }
289
+ }
290
+
332
291
  onPress(
333
292
  event: NativeSyntheticEvent<{
334
293
  payload: OnPressEvent;
335
294
  }>,
336
295
  ) {
337
- const {
338
- nativeEvent: {
339
- payload: { features, coordinates, point },
340
- },
341
- } = event;
296
+ const payload = this._decodePayload(event.nativeEvent.payload);
297
+ const { features, coordinates, point } = payload;
342
298
  let newEvent: OnPressEventDeprecated = {
343
299
  features,
344
300
  coordinates,
@@ -384,15 +340,15 @@ export class ShapeSource extends NativeBridgeComponent(
384
340
  ref: (
385
341
  nativeRef: React.Component<NativeProps> & Readonly<NativeMethods>,
386
342
  ) => this._setNativeRef(nativeRef),
387
- onAndroidCallback: isAndroid() ? this._onAndroidCallback : undefined,
388
343
  };
389
344
 
390
345
  return (
391
- <RNMBXShapeSource {...props}>
346
+ // @ts-expect-error just codegen stuff
347
+ <RNMBXShapeSourceNativeComponent {...props}>
392
348
  {cloneReactChildrenWithProps(this.props.children, {
393
349
  sourceID: this.props.id,
394
350
  })}
395
- </RNMBXShapeSource>
351
+ </RNMBXShapeSourceNativeComponent>
396
352
  );
397
353
  }
398
354
  }
@@ -401,6 +357,3 @@ type NativeProps = {
401
357
  id: string;
402
358
  shape?: string;
403
359
  };
404
-
405
- const RNMBXShapeSource =
406
- requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
@@ -3,16 +3,14 @@ import {
3
3
  NativeMethods,
4
4
  NativeModules,
5
5
  NativeSyntheticEvent,
6
- requireNativeComponent,
7
6
  } from 'react-native';
8
7
 
9
- import { cloneReactChildrenWithProps, isFunction, isAndroid } from '../utils';
10
- import { getFilter } from '../utils/filterUtils';
8
+ import RNMBXVectorSourceNativeComponent from '../specs/RNMBXVectorSourceNativeComponent';
9
+ import { cloneReactChildrenWithProps, isFunction } from '../utils';
11
10
  import { copyPropertiesAsDeprecated } from '../utils/deprecation';
12
11
  import { OnPressEvent } from '../types/OnPressEvent';
13
12
 
14
13
  import AbstractSource from './AbstractSource';
15
- import NativeBridgeComponent from './NativeBridgeComponent';
16
14
 
17
15
  const MapboxGL = NativeModules.RNMBXModule;
18
16
 
@@ -99,10 +97,7 @@ type NativeProps = Props; // Omit<Props, 'children'>;
99
97
  * VectorSource is a map content source that supplies tiled vector data in Mapbox Vector Tile format to be shown on the map.
100
98
  * The location of and metadata about the tiles are defined either by an option dictionary or by an external file that conforms to the TileJSON specification.
101
99
  */
102
- class VectorSource extends NativeBridgeComponent(
103
- AbstractSource<Props, NativeProps>,
104
- NATIVE_MODULE_NAME,
105
- ) {
100
+ class VectorSource extends AbstractSource<Props, NativeProps> {
106
101
  static defaultProps = {
107
102
  id: MapboxGL.StyleSource.DefaultSourceID,
108
103
  };
@@ -117,46 +112,26 @@ class VectorSource extends NativeBridgeComponent(
117
112
  if (nativeRef) {
118
113
  this.setNativeRef(nativeRef);
119
114
  // this._nativeRef = nativeRef;
120
- super._runPendingNativeCommands(nativeRef);
121
115
  }
122
116
  }
123
117
 
124
- /**
125
- * Returns all features that match the query parameters regardless of whether or not the feature is
126
- * currently rendered on the map. The domain of the query includes all currently-loaded vector tiles
127
- * and GeoJSON source tiles. This function does not check tiles outside of the visible viewport.
128
- *
129
- * @example
130
- * vectorSource.features(['id1', 'id2'])
131
- *
132
- * @param {Array=} layerIDs - A set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
133
- * @param {Array=} filter - an optional filter statement to filter the returned Features.
134
- * @return {FeatureCollection}
135
- */
136
- async features(layerIDs = [], filter = []) {
137
- const res: { data: string } = await this._runNativeCommand(
138
- 'features',
139
- this._nativeRef,
140
- [layerIDs, getFilter(filter)],
141
- );
142
-
143
- if (isAndroid()) {
144
- return JSON.parse(res.data);
118
+ _decodePayload(payload: OnPressEvent | string): OnPressEvent {
119
+ // we check whether the payload is a string, since the strict type safety is enforced only on iOS on the new arch
120
+ // on Android, on both archs, the payload is an object
121
+ if (typeof payload === 'string') {
122
+ return JSON.parse(payload);
123
+ } else {
124
+ return payload;
145
125
  }
146
-
147
- return res.data;
148
126
  }
149
127
 
150
128
  onPress(
151
129
  event: NativeSyntheticEvent<{
152
- payload: OnPressEvent;
130
+ payload: OnPressEvent | string;
153
131
  }>,
154
132
  ) {
155
- const {
156
- nativeEvent: {
157
- payload: { features, coordinates, point },
158
- },
159
- } = event;
133
+ const payload = this._decodePayload(event.nativeEvent.payload);
134
+ const { features, coordinates, point } = payload;
160
135
  let newEvent = {
161
136
  features,
162
137
  coordinates,
@@ -197,19 +172,20 @@ class VectorSource extends NativeBridgeComponent(
197
172
  hasPressListener: isFunction(this.props.onPress),
198
173
  onMapboxVectorSourcePress: this.onPress.bind(this),
199
174
  onPress: undefined,
200
- onAndroidCallback: isAndroid() ? this._onAndroidCallback : undefined,
201
175
  };
202
176
  return (
203
- <RNMBXVectorSource ref={(r) => this._setNativeRef(r)} {...props}>
177
+ // @ts-expect-error just codegen stuff
178
+ <RNMBXVectorSourceNativeComponent
179
+ // @ts-expect-error just codegen stuff
180
+ ref={(r) => this._setNativeRef(r)}
181
+ {...props}
182
+ >
204
183
  {cloneReactChildrenWithProps(this.props.children, {
205
184
  sourceID: this.props.id,
206
185
  })}
207
- </RNMBXVectorSource>
186
+ </RNMBXVectorSourceNativeComponent>
208
187
  );
209
188
  }
210
189
  }
211
190
 
212
- const RNMBXVectorSource =
213
- requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
214
-
215
191
  export default VectorSource;
@@ -0,0 +1,23 @@
1
+ /* eslint-disable @typescript-eslint/ban-types */
2
+ import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
3
+ import { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
4
+ import { TurboModuleRegistry } from 'react-native';
5
+
6
+ export interface Spec extends TurboModule {
7
+ getClusterExpansionZoom: (
8
+ viewRef: Int32 | null,
9
+ featureJSON: string,
10
+ ) => Promise<Object>;
11
+ getClusterLeaves: (
12
+ viewRef: Int32 | null,
13
+ featureJSON: string,
14
+ number: Int32,
15
+ offset: Int32,
16
+ ) => Promise<Object>;
17
+ getClusterChildren: (
18
+ viewRef: Int32 | null,
19
+ featureJSON: string,
20
+ ) => Promise<Object>;
21
+ }
22
+
23
+ export default TurboModuleRegistry.getEnforcing<Spec>('RNMBXShapeSourceModule');