@rnmapbox/maps 10.2.5 → 10.2.7

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 (37) hide show
  1. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt +4 -4
  2. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyle.kt +1 -1
  3. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleFactory.kt +0 -1
  4. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt +6 -2
  5. package/android/src/main/java/com/rnmapbox/rnmbx/modules/CustomHttpHeaders.kt +31 -9
  6. package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXModule.kt +15 -1
  7. package/android/src/main/java/com/rnmapbox/rnmbx/utils/ConvertUtils.kt +239 -0
  8. package/android/src/main/java/com/rnmapbox/rnmbx/utils/GeoJSONUtils.kt +5 -2
  9. package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt +29 -0
  10. package/android/src/test/kotlin/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValueTest.kt +2 -2
  11. package/ios/RNMBX/CustomHttpHeaders.swift +36 -7
  12. package/ios/RNMBX/RNMBXCustomLocationProvider.swift +4 -1
  13. package/ios/RNMBX/RNMBXCustomLocationProviderComponentView.mm +12 -2
  14. package/ios/RNMBX/RNMBXFabricPropConvert.h +12 -4
  15. package/ios/RNMBX/RNMBXFabricPropConvert.mm +4 -0
  16. package/ios/RNMBX/RNMBXMapViewComponentView.mm +2 -0
  17. package/ios/RNMBX/RNMBXModule.m +1 -0
  18. package/ios/RNMBX/RNMBXModule.swift +16 -2
  19. package/ios/RNMBX/Utils/RNMBXViewResolver.mm +15 -2
  20. package/lib/commonjs/plugin/build/withMapbox.js +8 -8
  21. package/lib/commonjs/plugin/src/withMapbox.ts +8 -8
  22. package/lib/module/RNMBXModule.js +15 -1
  23. package/lib/module/RNMBXModule.js.map +1 -1
  24. package/lib/module/components/MapView.js +1 -1
  25. package/lib/typescript/plugin/build/withMapbox.d.ts +1 -6
  26. package/lib/typescript/plugin/build/withMapbox.d.ts.map +1 -1
  27. package/lib/typescript/src/RNMBXModule.d.ts +11 -1
  28. package/lib/typescript/src/RNMBXModule.d.ts.map +1 -1
  29. package/lib/typescript/src/components/MapView.d.ts +1 -1
  30. package/package.json +1 -1
  31. package/plugin/build/withMapbox.js +8 -8
  32. package/plugin/src/withMapbox.ts +8 -8
  33. package/src/RNMBXModule.ts +29 -3
  34. package/src/components/MapView.tsx +1 -1
  35. package/android/src/main/java/com/rnmapbox/rnmbx/utils/ConvertUtils.java +0 -253
  36. package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/Layers.kt +0 -35
  37. package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/v11compat/Layers.kt +0 -1
@@ -190,6 +190,8 @@ using namespace facebook::react;
190
190
  RNMBX_REMAP_OPTIONAL_PROP_BOOL(rotateEnabled, reactRotateEnabled)
191
191
 
192
192
  RNMBX_REMAP_OPTIONAL_PROP_BOOL(pitchEnabled, reactPitchEnabled)
193
+
194
+ RNMBX_REMAP_OPTIONAL_PROP_NSDictionary(gestureSettings, reactGestureSettings)
193
195
 
194
196
  id preferredFramesPerSecond = RNMBXConvertFollyDynamicToId(newViewProps.preferredFramesPerSecond);
195
197
  if (preferredFramesPerSecond != nil) {
@@ -5,6 +5,7 @@
5
5
  RCT_EXTERN_METHOD(setAccessToken:(NSString *)accessToken resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
6
6
 
7
7
  RCT_EXTERN_METHOD(addCustomHeader:(NSString *)headerName forHeaderValue:(NSString *) headerValue)
8
+ RCT_EXTERN_METHOD(addCustomHeaderWithOptions:(NSString *)headerName forHeaderValue:(NSString *) headerValue forOptions:(nullable NSDictionary *) options)
8
9
  RCT_EXTERN_METHOD(removeCustomHeader:(NSString *)headerName)
9
10
 
10
11
  RCT_EXTERN_METHOD(setTelemetryEnabled:(BOOL)telemetryEnabled)
@@ -98,9 +98,23 @@ class RNMBXModule : NSObject {
98
98
  RNMBXModule.accessToken = token
99
99
  resolver(token)
100
100
  }
101
+
102
+ @objc func addCustomHeader(_ headerName: String, forHeaderValue headerValue: String) {
103
+ addCustomHeaderWithOptions(headerName, forHeaderValue: headerValue, forOptions: nil)
104
+ }
101
105
 
102
- @objc func addCustomHeader(_ headerName: String, forHeaderValue headerValue: String ) {
103
- CustomHttpHeaders.shared.customHeaders[headerName] = headerValue
106
+ @objc func addCustomHeaderWithOptions(_ headerName: String, forHeaderValue headerValue: String, forOptions options: NSDictionary?) {
107
+ var urlRegexp: NSRegularExpression? = nil
108
+ if let pattern = options?.value(forKey: "urlRegexp") as? String {
109
+ do {
110
+ urlRegexp = try NSRegularExpression(pattern: pattern)
111
+ }
112
+ catch {
113
+ Logger.log(level: .error, message: "Invalid regex pattern: \(error.localizedDescription)")
114
+ }
115
+ }
116
+
117
+ CustomHttpHeaders.shared.customHeaders[headerName] = CustomHttpHeadersMapValue(headerValue: headerValue, options: CustomHttpHeadersOptions(urlRegexp: urlRegexp))
104
118
  }
105
119
 
106
120
  @objc func removeCustomHeader(_ headerName: String) {
@@ -6,6 +6,12 @@
6
6
 
7
7
  #import "RNMBXViewResolver.h"
8
8
 
9
+ // View resolution timeout and delay constants
10
+ static const NSTimeInterval MAX_TIMEOUT = 10.0; // 10 seconds
11
+ static const int64_t DELAY_ON_FIRST_ATTEMPT = (NSEC_PER_MSEC/5); // 0.2ms
12
+ static const int64_t DELAY_ON_NEXT_5_ATTEMPTS = 10 * NSEC_PER_MSEC; // 10ms
13
+ static const int64_t DELAY_ON_FURTHER_ATTEMPTS = 200 * NSEC_PER_MSEC; // 200ms
14
+
9
15
  @implementation RNMBXViewResolver
10
16
 
11
17
  + (void)withViewRef:(NSNumber *)viewRef
@@ -84,7 +90,7 @@
84
90
  }
85
91
 
86
92
  NSTimeInterval elapsed = [[NSDate date] timeIntervalSinceDate:startTime];
87
- if (elapsed >= 0.2) { // 200ms timeout
93
+ if (elapsed >= MAX_TIMEOUT) {
88
94
  NSString *errorMsg = [NSString stringWithFormat:@"Could not find view with tag %@ in %@ after %d attempts over %.1fms",
89
95
  viewRef, methodName, (int)attemptCount + 1, elapsed * 1000];
90
96
  NSLog(@"%@", errorMsg);
@@ -92,7 +98,14 @@
92
98
  return;
93
99
  }
94
100
 
95
- int64_t delay = (attemptCount == 0) ? (NSEC_PER_MSEC/5) : 10 * NSEC_PER_MSEC;
101
+ int64_t delay;
102
+ if (attemptCount == 0) {
103
+ delay = DELAY_ON_FIRST_ATTEMPT;
104
+ } else if (attemptCount <= 5) {
105
+ delay = DELAY_ON_NEXT_5_ATTEMPTS;
106
+ } else {
107
+ delay = DELAY_ON_FURTHER_ATTEMPTS;
108
+ }
96
109
  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delay), dispatch_get_main_queue(), ^{
97
110
  [self resolveViewWithPolling:viewRef
98
111
  delegate:delegate
@@ -117,7 +117,7 @@ exports.addMapboxInstallerBlock = addMapboxInstallerBlock;
117
117
  *
118
118
  * https://github.com/rnmapbox/maps/blob/main/ios/install.md#react-native--0600
119
119
  */
120
- const withCocoaPodsInstallerBlocks = (config, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsDownloadToken, RNMapboxMapsUseV11, }) => (0, config_plugins_1.withDangerousMod)(config, [
120
+ const withCocoaPodsInstallerBlocks = (config, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsDownloadToken, RNMapboxMapsUseV11, } = {}) => (0, config_plugins_1.withDangerousMod)(config, [
121
121
  'ios',
122
122
  async (exportedConfig) => {
123
123
  const file = path_1.default.join(exportedConfig.modRequest.platformProjectRoot, 'Podfile');
@@ -131,7 +131,7 @@ const withCocoaPodsInstallerBlocks = (config, { RNMapboxMapsImpl, RNMapboxMapsVe
131
131
  return exportedConfig;
132
132
  },
133
133
  ]);
134
- const withAndroidPropertiesDownloadToken = (config, { RNMapboxMapsDownloadToken }) => {
134
+ const withAndroidPropertiesDownloadToken = (config, { RNMapboxMapsDownloadToken } = {}) => {
135
135
  const key = 'MAPBOX_DOWNLOADS_TOKEN';
136
136
  if (RNMapboxMapsDownloadToken) {
137
137
  console.warn('⚠️ WARNING: RNMapboxMapsDownloadToken is deprecated. Use RNMAPBOX_MAPS_DOWNLOAD_TOKEN environment variable instead.');
@@ -148,7 +148,7 @@ const withAndroidPropertiesDownloadToken = (config, { RNMapboxMapsDownloadToken
148
148
  }
149
149
  return config;
150
150
  };
151
- const withAndroidPropertiesImpl2 = (config, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsUseV11 }) => {
151
+ const withAndroidPropertiesImpl2 = (config, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsUseV11 } = {}) => {
152
152
  const keyValues = {
153
153
  expoRNMapboxMapsImpl: RNMapboxMapsImpl,
154
154
  expoRNMapboxMapsVersion: RNMapboxMapsVersion,
@@ -174,7 +174,7 @@ const withAndroidPropertiesImpl2 = (config, { RNMapboxMapsImpl, RNMapboxMapsVers
174
174
  }
175
175
  return config;
176
176
  };
177
- const withAndroidProperties = (config, { RNMapboxMapsImpl, RNMapboxMapsDownloadToken, RNMapboxMapsVersion, RNMapboxMapsUseV11, }) => {
177
+ const withAndroidProperties = (config, { RNMapboxMapsImpl, RNMapboxMapsDownloadToken, RNMapboxMapsVersion, RNMapboxMapsUseV11, } = {}) => {
178
178
  config = withAndroidPropertiesDownloadToken(config, {
179
179
  RNMapboxMapsDownloadToken,
180
180
  });
@@ -256,7 +256,7 @@ const addMapboxMavenRepo = (src) => appendContents({
256
256
  }).contents;
257
257
  exports.addMapboxMavenRepo = addMapboxMavenRepo;
258
258
  exports._addMapboxMavenRepo = exports.addMapboxMavenRepo;
259
- const withAndroidAppGradle = (config) => (0, config_plugins_1.withAppBuildGradle)(config, ({ modResults, ...exportedConfig }) => {
259
+ const withAndroidAppGradle = (config, _props = {}) => (0, config_plugins_1.withAppBuildGradle)(config, ({ modResults, ...exportedConfig }) => {
260
260
  if (modResults.language !== 'groovy') {
261
261
  config_plugins_1.WarningAggregator.addWarningAndroid('withMapbox', `Cannot automatically configure app build.gradle if it's not groovy`);
262
262
  return { modResults, ...exportedConfig };
@@ -264,7 +264,7 @@ const withAndroidAppGradle = (config) => (0, config_plugins_1.withAppBuildGradle
264
264
  modResults.contents = addLibCppFilter(modResults.contents);
265
265
  return { modResults, ...exportedConfig };
266
266
  });
267
- const withAndroidProjectGradle = (config) => (0, config_plugins_1.withProjectBuildGradle)(config, ({ modResults, ...exportedConfig }) => {
267
+ const withAndroidProjectGradle = (config, _props = {}) => (0, config_plugins_1.withProjectBuildGradle)(config, ({ modResults, ...exportedConfig }) => {
268
268
  if (modResults.language !== 'groovy') {
269
269
  config_plugins_1.WarningAggregator.addWarningAndroid('withMapbox', `Cannot automatically configure app build.gradle if it's not groovy`);
270
270
  return { modResults, ...exportedConfig };
@@ -272,7 +272,7 @@ const withAndroidProjectGradle = (config) => (0, config_plugins_1.withProjectBui
272
272
  modResults.contents = (0, exports.addMapboxMavenRepo)(modResults.contents);
273
273
  return { modResults, ...exportedConfig };
274
274
  });
275
- const withMapboxAndroid = (config, { RNMapboxMapsImpl, RNMapboxMapsDownloadToken, RNMapboxMapsVersion, RNMapboxMapsUseV11, }) => {
275
+ const withMapboxAndroid = (config, { RNMapboxMapsImpl, RNMapboxMapsDownloadToken, RNMapboxMapsVersion, RNMapboxMapsUseV11, } = {}) => {
276
276
  config = withAndroidProperties(config, {
277
277
  RNMapboxMapsImpl,
278
278
  RNMapboxMapsDownloadToken,
@@ -283,7 +283,7 @@ const withMapboxAndroid = (config, { RNMapboxMapsImpl, RNMapboxMapsDownloadToken
283
283
  config = withAndroidAppGradle(config, { RNMapboxMapsImpl });
284
284
  return config;
285
285
  };
286
- const withMapbox = (config, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsDownloadToken, RNMapboxMapsUseV11, }) => {
286
+ const withMapbox = (config, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsDownloadToken, RNMapboxMapsUseV11, } = {}) => {
287
287
  config = withMapboxAndroid(config, {
288
288
  RNMapboxMapsImpl,
289
289
  RNMapboxMapsVersion,
@@ -188,7 +188,7 @@ const withCocoaPodsInstallerBlocks: ConfigPlugin<MapboxPlugProps> = (
188
188
  RNMapboxMapsVersion,
189
189
  RNMapboxMapsDownloadToken,
190
190
  RNMapboxMapsUseV11,
191
- },
191
+ }: MapboxPlugProps = {},
192
192
  ) =>
193
193
  withDangerousMod(config, [
194
194
  'ios',
@@ -216,7 +216,7 @@ const withCocoaPodsInstallerBlocks: ConfigPlugin<MapboxPlugProps> = (
216
216
 
217
217
  const withAndroidPropertiesDownloadToken: ConfigPlugin<MapboxPlugProps> = (
218
218
  config,
219
- { RNMapboxMapsDownloadToken },
219
+ { RNMapboxMapsDownloadToken }: MapboxPlugProps = {},
220
220
  ) => {
221
221
  const key = 'MAPBOX_DOWNLOADS_TOKEN';
222
222
 
@@ -247,7 +247,7 @@ const withAndroidPropertiesDownloadToken: ConfigPlugin<MapboxPlugProps> = (
247
247
 
248
248
  const withAndroidPropertiesImpl2: ConfigPlugin<MapboxPlugProps> = (
249
249
  config,
250
- { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsUseV11 },
250
+ { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsUseV11 }: MapboxPlugProps = {},
251
251
  ) => {
252
252
  const keyValues = {
253
253
  expoRNMapboxMapsImpl: RNMapboxMapsImpl,
@@ -289,7 +289,7 @@ const withAndroidProperties: ConfigPlugin<MapboxPlugProps> = (
289
289
  RNMapboxMapsDownloadToken,
290
290
  RNMapboxMapsVersion,
291
291
  RNMapboxMapsUseV11,
292
- },
292
+ }: MapboxPlugProps = {},
293
293
  ) => {
294
294
  config = withAndroidPropertiesDownloadToken(config, {
295
295
  RNMapboxMapsDownloadToken,
@@ -391,7 +391,7 @@ export const addMapboxMavenRepo = (src: string): string =>
391
391
  comment: '//',
392
392
  }).contents;
393
393
 
394
- const withAndroidAppGradle: ConfigPlugin<MapboxPlugProps> = (config) =>
394
+ const withAndroidAppGradle: ConfigPlugin<MapboxPlugProps> = (config, _props: MapboxPlugProps = {}) =>
395
395
  withAppBuildGradle(config, ({ modResults, ...exportedConfig }) => {
396
396
  if (modResults.language !== 'groovy') {
397
397
  WarningAggregator.addWarningAndroid(
@@ -407,7 +407,7 @@ const withAndroidAppGradle: ConfigPlugin<MapboxPlugProps> = (config) =>
407
407
  return { modResults, ...exportedConfig };
408
408
  });
409
409
 
410
- const withAndroidProjectGradle: ConfigPlugin<MapboxPlugProps> = (config) =>
410
+ const withAndroidProjectGradle: ConfigPlugin<MapboxPlugProps> = (config, _props: MapboxPlugProps = {}) =>
411
411
  withProjectBuildGradle(config, ({ modResults, ...exportedConfig }) => {
412
412
  if (modResults.language !== 'groovy') {
413
413
  WarningAggregator.addWarningAndroid(
@@ -430,7 +430,7 @@ const withMapboxAndroid: ConfigPlugin<MapboxPlugProps> = (
430
430
  RNMapboxMapsDownloadToken,
431
431
  RNMapboxMapsVersion,
432
432
  RNMapboxMapsUseV11,
433
- },
433
+ }: MapboxPlugProps = {},
434
434
  ) => {
435
435
  config = withAndroidProperties(config, {
436
436
  RNMapboxMapsImpl,
@@ -451,7 +451,7 @@ const withMapbox: ConfigPlugin<MapboxPlugProps> = (
451
451
  RNMapboxMapsVersion,
452
452
  RNMapboxMapsDownloadToken,
453
453
  RNMapboxMapsUseV11,
454
- },
454
+ }: MapboxPlugProps = {},
455
455
  ) => {
456
456
  config = withMapboxAndroid(config, {
457
457
  RNMapboxMapsImpl,
@@ -10,6 +10,20 @@ if (NativeModules.RNMBXModule == null) {
10
10
  throw new Error('@rnmapbox/maps native code not available. Make sure you have linked the library and rebuild your app. See https://rnmapbox.github.io/docs/install');
11
11
  }
12
12
  }
13
+
14
+ /**
15
+ * Add a custom header to HTTP requests.
16
+ * @param headerName - The name of the header
17
+ * @param headerValue - The value of the header
18
+ * @param options - Optional configuration. If provided with urlRegexp, the header will only be added to URLs matching the regex
19
+ */
20
+ function addCustomHeader(headerName, headerValue, options) {
21
+ if (options) {
22
+ RNMBXModule.addCustomHeaderWithOptions(headerName, headerValue, options);
23
+ } else {
24
+ RNMBXModule.addCustomHeader(headerName, headerValue);
25
+ }
26
+ }
13
27
  export const {
14
28
  StyleURL,
15
29
  OfflinePackDownloadState,
@@ -17,7 +31,6 @@ export const {
17
31
  StyleSource,
18
32
  TileServers,
19
33
  removeCustomHeader,
20
- addCustomHeader,
21
34
  setAccessToken,
22
35
  setWellKnownTileServer,
23
36
  clearData,
@@ -25,4 +38,5 @@ export const {
25
38
  setTelemetryEnabled,
26
39
  setConnected
27
40
  } = RNMBXModule;
41
+ export { addCustomHeader };
28
42
  //# sourceMappingURL=RNMBXModule.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","RNMBXModule","global","expo","Error","StyleURL","OfflinePackDownloadState","LineJoin","StyleSource","TileServers","removeCustomHeader","addCustomHeader","setAccessToken","setWellKnownTileServer","clearData","getAccessToken","setTelemetryEnabled","setConnected"],"sourceRoot":"../../src","sources":["RNMBXModule.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,cAAc;AAuC5C,MAAMC,WAAwB,GAAGD,aAAa,CAACC,WAAW;AAC1D,IAAID,aAAa,CAACC,WAAW,IAAI,IAAI,EAAE;EACrC,IAAKC,MAAM,CAAwBC,IAAI,IAAI,IAAI,EAAE;IAC/C;IACA,MAAM,IAAIC,KAAK,CACb,wKACF,CAAC;EACH,CAAC,MAAM;IACL,MAAM,IAAIA,KAAK,CACb,mJACF,CAAC;EACH;AACF;AAEA,OAAO,MAAM;EACXC,QAAQ;EACRC,wBAAwB;EACxBC,QAAQ;EACRC,WAAW;EACXC,WAAW;EACXC,kBAAkB;EAClBC,eAAe;EACfC,cAAc;EACdC,sBAAsB;EACtBC,SAAS;EACTC,cAAc;EACdC,mBAAmB;EACnBC;AACF,CAAC,GAAGhB,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["NativeModules","RNMBXModule","global","expo","Error","addCustomHeader","headerName","headerValue","options","addCustomHeaderWithOptions","StyleURL","OfflinePackDownloadState","LineJoin","StyleSource","TileServers","removeCustomHeader","setAccessToken","setWellKnownTileServer","clearData","getAccessToken","setTelemetryEnabled","setConnected"],"sourceRoot":"../../src","sources":["RNMBXModule.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,cAAc;AA8C5C,MAAMC,WAAwB,GAAGD,aAAa,CAACC,WAAW;AAC1D,IAAID,aAAa,CAACC,WAAW,IAAI,IAAI,EAAE;EACrC,IAAKC,MAAM,CAAwBC,IAAI,IAAI,IAAI,EAAE;IAC/C;IACA,MAAM,IAAIC,KAAK,CACb,wKACF,CAAC;EACH,CAAC,MAAM;IACL,MAAM,IAAIA,KAAK,CACb,mJACF,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CACtBC,UAAkB,EAClBC,WAAmB,EACnBC,OAAgC,EAC1B;EACN,IAAIA,OAAO,EAAE;IACXP,WAAW,CAACQ,0BAA0B,CAACH,UAAU,EAAEC,WAAW,EAAEC,OAAO,CAAC;EAC1E,CAAC,MAAM;IACLP,WAAW,CAACI,eAAe,CAACC,UAAU,EAAEC,WAAW,CAAC;EACtD;AACF;AAEA,OAAO,MAAM;EACXG,QAAQ;EACRC,wBAAwB;EACxBC,QAAQ;EACRC,WAAW;EACXC,WAAW;EACXC,kBAAkB;EAClBC,cAAc;EACdC,sBAAsB;EACtBC,SAAS;EACTC,cAAc;EACdC,mBAAmB;EACnBC;AACF,CAAC,GAAGpB,WAAW;AAEf,SAASI,eAAe","ignoreList":[]}
@@ -231,7 +231,7 @@ class MapView extends NativeBridgeComponent(React.PureComponent, NativeMapViewMo
231
231
  * @example
232
232
  * this._map.queryRenderedFeaturesInRect([30, 40, 20, 10], ['==', 'type', 'Point'], ['id1', 'id2'])
233
233
  *
234
- * @param {Array<Number>} bbox - A rectangle expressed in the map view’s coordinate system. For v10, this can be an empty array to query the visible map area.
234
+ * @param {Array<Number>} bbox - A rectangle expressed in the map view’s coordinate system, density independent pixels and not map coordinates. This can be an empty array to query the visible map area.
235
235
  * @param {Array=} filter - 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.
236
236
  * @param {Array=} layerIDs - A array of layer id's to filter the features by
237
237
  * @return {FeatureCollection}
@@ -1,10 +1,5 @@
1
1
  export const __esModule: boolean;
2
- declare const _default: config_plugins_1.ConfigPlugin<{
3
- RNMapboxMapsImpl: any;
4
- RNMapboxMapsVersion: any;
5
- RNMapboxMapsDownloadToken: any;
6
- RNMapboxMapsUseV11: any;
7
- }>;
2
+ declare const _default: config_plugins_1.ConfigPlugin<{} | undefined>;
8
3
  export default _default;
9
4
  export function addInstallerBlock(src: any, blockName: any): any;
10
5
  export function addConstantBlock(src: any, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsDownloadToken, RNMapboxMapsUseV11, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"withMapbox.d.ts","sourceRoot":"","sources":["../../../../plugin/build/withMapbox.js"],"names":[],"mappings":";;;;;;;;AAmBA,iEA2BC;AAED;;;;;QAqCC;AAID;;;;;QAaC;AAED,0EAOW;AA2IX,kDAKW"}
1
+ {"version":3,"file":"withMapbox.d.ts","sourceRoot":"","sources":["../../../../plugin/build/withMapbox.js"],"names":[],"mappings":";;;AAmBA,iEA2BC;AAED;;;;;QAqCC;AAID;;;;;QAaC;AAED,0EAOW;AA2IX,kDAKW"}
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Add a custom header to HTTP requests.
3
+ * @param headerName - The name of the header
4
+ * @param headerValue - The value of the header
5
+ * @param options - Optional configuration. If provided with urlRegexp, the header will only be added to URLs matching the regex
6
+ */
7
+ declare function addCustomHeader(headerName: string, headerValue: string, options?: {
8
+ urlRegexp?: string;
9
+ }): void;
1
10
  export declare const StyleURL: {
2
11
  Street: URL;
3
12
  Outdoors: URL;
@@ -18,5 +27,6 @@ export declare const StyleURL: {
18
27
  DefaultSourceID: string;
19
28
  }, TileServers: {
20
29
  Mapbox: string;
21
- }, removeCustomHeader: (headerName: string) => void, addCustomHeader: (headerName: string, headerValue: string) => void, setAccessToken: (accessToken: string | null) => Promise<string | null>, setWellKnownTileServer: (tileServer: string) => void, clearData: () => Promise<void>, getAccessToken: () => Promise<string>, setTelemetryEnabled: (telemetryEnabled: boolean) => void, setConnected: (connected: boolean) => void;
30
+ }, removeCustomHeader: (headerName: string) => void, setAccessToken: (accessToken: string | null) => Promise<string | null>, setWellKnownTileServer: (tileServer: string) => void, clearData: () => Promise<void>, getAccessToken: () => Promise<string>, setTelemetryEnabled: (telemetryEnabled: boolean) => void, setConnected: (connected: boolean) => void;
31
+ export { addCustomHeader };
22
32
  //# sourceMappingURL=RNMBXModule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RNMBXModule.d.ts","sourceRoot":"","sources":["../../../src/RNMBXModule.ts"],"names":[],"mappings":"AAqDA,eAAO,MACL,QAAQ;YAlDE,GAAG;cACD,GAAG;WACN,GAAG;UACJ,GAAG;eACE,GAAG;qBACG,GAAG;GA8CtB,wBAAwB;cA3CZ,MAAM,GAAG,MAAM;YACjB,MAAM,GAAG,MAAM;cACb,MAAM,GAAG,MAAM;cACf,MAAM,GAAG,MAAM;GAyC3B,QAAQ;WAtCC,MAAM,GAAG,MAAM;WACf,MAAM,GAAG,MAAM;WACf,MAAM,GAAG,MAAM;GAqCxB,WAAW;qBAlCQ,MAAM;GAmCzB,WAAW;YAhCD,MAAM;GAiChB,kBAAkB,eA9Ba,MAAM,KAAG,IAAI,EA+B5C,eAAe,eA9Ba,MAAM,eAAe,MAAM,KAAG,IAAI,EA+B9D,cAAc,gBA9Bc,MAAM,GAAG,IAAI,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EA+BlE,sBAAsB,eA9Ba,MAAM,KAAG,IAAI,EA+BhD,SAAS,QA9BI,OAAO,CAAC,IAAI,CAAC,EA+B1B,cAAc,QA9BI,OAAO,CAAC,MAAM,CAAC,EA+BjC,mBAAmB,qBA9BmB,OAAO,KAAG,IAAI,EA+BpD,YAAY,cA9BY,OAAO,KAAG,IA+BrB,CAAC"}
1
+ {"version":3,"file":"RNMBXModule.d.ts","sourceRoot":"","sources":["../../../src/RNMBXModule.ts"],"names":[],"mappings":"AA4DA;;;;;GAKG;AACH,iBAAS,eAAe,CACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/B,IAAI,CAMN;AAED,eAAO,MACL,QAAQ;YA3EE,GAAG;cACD,GAAG;WACN,GAAG;UACJ,GAAG;eACE,GAAG;qBACG,GAAG;GAuEtB,wBAAwB;cApEZ,MAAM,GAAG,MAAM;YACjB,MAAM,GAAG,MAAM;cACb,MAAM,GAAG,MAAM;cACf,MAAM,GAAG,MAAM;GAkE3B,QAAQ;WA/DC,MAAM,GAAG,MAAM;WACf,MAAM,GAAG,MAAM;WACf,MAAM,GAAG,MAAM;GA8DxB,WAAW;qBA3DQ,MAAM;GA4DzB,WAAW;YAzDD,MAAM;GA0DhB,kBAAkB,eAxDa,MAAM,KAAG,IAAI,EAyD5C,cAAc,gBA/Cc,MAAM,GAAG,IAAI,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EAgDlE,sBAAsB,eA/Ca,MAAM,KAAG,IAAI,EAgDhD,SAAS,QA/CI,OAAO,CAAC,IAAI,CAAC,EAgD1B,cAAc,QA/CI,OAAO,CAAC,MAAM,CAAC,EAgDjC,mBAAmB,qBA/CmB,OAAO,KAAG,IAAI,EAgDpD,YAAY,cA/CY,OAAO,KAAG,IAgDrB,CAAC;AAEhB,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -460,7 +460,7 @@ declare class MapView extends MapView_base {
460
460
  * @example
461
461
  * this._map.queryRenderedFeaturesInRect([30, 40, 20, 10], ['==', 'type', 'Point'], ['id1', 'id2'])
462
462
  *
463
- * @param {Array<Number>} bbox - A rectangle expressed in the map view’s coordinate system. For v10, this can be an empty array to query the visible map area.
463
+ * @param {Array<Number>} bbox - A rectangle expressed in the map view’s coordinate system, density independent pixels and not map coordinates. This can be an empty array to query the visible map area.
464
464
  * @param {Array=} filter - 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.
465
465
  * @param {Array=} layerIDs - A array of layer id's to filter the features by
466
466
  * @return {FeatureCollection}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnmapbox/maps",
3
- "version": "10.2.5",
3
+ "version": "10.2.7",
4
4
  "description": "Community-supported, open-source React Native library for building maps using Mapbox native maps SDK for iOS and Android",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.native.d.ts",
@@ -117,7 +117,7 @@ exports.addMapboxInstallerBlock = addMapboxInstallerBlock;
117
117
  *
118
118
  * https://github.com/rnmapbox/maps/blob/main/ios/install.md#react-native--0600
119
119
  */
120
- const withCocoaPodsInstallerBlocks = (config, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsDownloadToken, RNMapboxMapsUseV11, }) => (0, config_plugins_1.withDangerousMod)(config, [
120
+ const withCocoaPodsInstallerBlocks = (config, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsDownloadToken, RNMapboxMapsUseV11, } = {}) => (0, config_plugins_1.withDangerousMod)(config, [
121
121
  'ios',
122
122
  async (exportedConfig) => {
123
123
  const file = path_1.default.join(exportedConfig.modRequest.platformProjectRoot, 'Podfile');
@@ -131,7 +131,7 @@ const withCocoaPodsInstallerBlocks = (config, { RNMapboxMapsImpl, RNMapboxMapsVe
131
131
  return exportedConfig;
132
132
  },
133
133
  ]);
134
- const withAndroidPropertiesDownloadToken = (config, { RNMapboxMapsDownloadToken }) => {
134
+ const withAndroidPropertiesDownloadToken = (config, { RNMapboxMapsDownloadToken } = {}) => {
135
135
  const key = 'MAPBOX_DOWNLOADS_TOKEN';
136
136
  if (RNMapboxMapsDownloadToken) {
137
137
  console.warn('⚠️ WARNING: RNMapboxMapsDownloadToken is deprecated. Use RNMAPBOX_MAPS_DOWNLOAD_TOKEN environment variable instead.');
@@ -148,7 +148,7 @@ const withAndroidPropertiesDownloadToken = (config, { RNMapboxMapsDownloadToken
148
148
  }
149
149
  return config;
150
150
  };
151
- const withAndroidPropertiesImpl2 = (config, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsUseV11 }) => {
151
+ const withAndroidPropertiesImpl2 = (config, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsUseV11 } = {}) => {
152
152
  const keyValues = {
153
153
  expoRNMapboxMapsImpl: RNMapboxMapsImpl,
154
154
  expoRNMapboxMapsVersion: RNMapboxMapsVersion,
@@ -174,7 +174,7 @@ const withAndroidPropertiesImpl2 = (config, { RNMapboxMapsImpl, RNMapboxMapsVers
174
174
  }
175
175
  return config;
176
176
  };
177
- const withAndroidProperties = (config, { RNMapboxMapsImpl, RNMapboxMapsDownloadToken, RNMapboxMapsVersion, RNMapboxMapsUseV11, }) => {
177
+ const withAndroidProperties = (config, { RNMapboxMapsImpl, RNMapboxMapsDownloadToken, RNMapboxMapsVersion, RNMapboxMapsUseV11, } = {}) => {
178
178
  config = withAndroidPropertiesDownloadToken(config, {
179
179
  RNMapboxMapsDownloadToken,
180
180
  });
@@ -256,7 +256,7 @@ const addMapboxMavenRepo = (src) => appendContents({
256
256
  }).contents;
257
257
  exports.addMapboxMavenRepo = addMapboxMavenRepo;
258
258
  exports._addMapboxMavenRepo = exports.addMapboxMavenRepo;
259
- const withAndroidAppGradle = (config) => (0, config_plugins_1.withAppBuildGradle)(config, ({ modResults, ...exportedConfig }) => {
259
+ const withAndroidAppGradle = (config, _props = {}) => (0, config_plugins_1.withAppBuildGradle)(config, ({ modResults, ...exportedConfig }) => {
260
260
  if (modResults.language !== 'groovy') {
261
261
  config_plugins_1.WarningAggregator.addWarningAndroid('withMapbox', `Cannot automatically configure app build.gradle if it's not groovy`);
262
262
  return { modResults, ...exportedConfig };
@@ -264,7 +264,7 @@ const withAndroidAppGradle = (config) => (0, config_plugins_1.withAppBuildGradle
264
264
  modResults.contents = addLibCppFilter(modResults.contents);
265
265
  return { modResults, ...exportedConfig };
266
266
  });
267
- const withAndroidProjectGradle = (config) => (0, config_plugins_1.withProjectBuildGradle)(config, ({ modResults, ...exportedConfig }) => {
267
+ const withAndroidProjectGradle = (config, _props = {}) => (0, config_plugins_1.withProjectBuildGradle)(config, ({ modResults, ...exportedConfig }) => {
268
268
  if (modResults.language !== 'groovy') {
269
269
  config_plugins_1.WarningAggregator.addWarningAndroid('withMapbox', `Cannot automatically configure app build.gradle if it's not groovy`);
270
270
  return { modResults, ...exportedConfig };
@@ -272,7 +272,7 @@ const withAndroidProjectGradle = (config) => (0, config_plugins_1.withProjectBui
272
272
  modResults.contents = (0, exports.addMapboxMavenRepo)(modResults.contents);
273
273
  return { modResults, ...exportedConfig };
274
274
  });
275
- const withMapboxAndroid = (config, { RNMapboxMapsImpl, RNMapboxMapsDownloadToken, RNMapboxMapsVersion, RNMapboxMapsUseV11, }) => {
275
+ const withMapboxAndroid = (config, { RNMapboxMapsImpl, RNMapboxMapsDownloadToken, RNMapboxMapsVersion, RNMapboxMapsUseV11, } = {}) => {
276
276
  config = withAndroidProperties(config, {
277
277
  RNMapboxMapsImpl,
278
278
  RNMapboxMapsDownloadToken,
@@ -283,7 +283,7 @@ const withMapboxAndroid = (config, { RNMapboxMapsImpl, RNMapboxMapsDownloadToken
283
283
  config = withAndroidAppGradle(config, { RNMapboxMapsImpl });
284
284
  return config;
285
285
  };
286
- const withMapbox = (config, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsDownloadToken, RNMapboxMapsUseV11, }) => {
286
+ const withMapbox = (config, { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsDownloadToken, RNMapboxMapsUseV11, } = {}) => {
287
287
  config = withMapboxAndroid(config, {
288
288
  RNMapboxMapsImpl,
289
289
  RNMapboxMapsVersion,
@@ -188,7 +188,7 @@ const withCocoaPodsInstallerBlocks: ConfigPlugin<MapboxPlugProps> = (
188
188
  RNMapboxMapsVersion,
189
189
  RNMapboxMapsDownloadToken,
190
190
  RNMapboxMapsUseV11,
191
- },
191
+ }: MapboxPlugProps = {},
192
192
  ) =>
193
193
  withDangerousMod(config, [
194
194
  'ios',
@@ -216,7 +216,7 @@ const withCocoaPodsInstallerBlocks: ConfigPlugin<MapboxPlugProps> = (
216
216
 
217
217
  const withAndroidPropertiesDownloadToken: ConfigPlugin<MapboxPlugProps> = (
218
218
  config,
219
- { RNMapboxMapsDownloadToken },
219
+ { RNMapboxMapsDownloadToken }: MapboxPlugProps = {},
220
220
  ) => {
221
221
  const key = 'MAPBOX_DOWNLOADS_TOKEN';
222
222
 
@@ -247,7 +247,7 @@ const withAndroidPropertiesDownloadToken: ConfigPlugin<MapboxPlugProps> = (
247
247
 
248
248
  const withAndroidPropertiesImpl2: ConfigPlugin<MapboxPlugProps> = (
249
249
  config,
250
- { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsUseV11 },
250
+ { RNMapboxMapsImpl, RNMapboxMapsVersion, RNMapboxMapsUseV11 }: MapboxPlugProps = {},
251
251
  ) => {
252
252
  const keyValues = {
253
253
  expoRNMapboxMapsImpl: RNMapboxMapsImpl,
@@ -289,7 +289,7 @@ const withAndroidProperties: ConfigPlugin<MapboxPlugProps> = (
289
289
  RNMapboxMapsDownloadToken,
290
290
  RNMapboxMapsVersion,
291
291
  RNMapboxMapsUseV11,
292
- },
292
+ }: MapboxPlugProps = {},
293
293
  ) => {
294
294
  config = withAndroidPropertiesDownloadToken(config, {
295
295
  RNMapboxMapsDownloadToken,
@@ -391,7 +391,7 @@ export const addMapboxMavenRepo = (src: string): string =>
391
391
  comment: '//',
392
392
  }).contents;
393
393
 
394
- const withAndroidAppGradle: ConfigPlugin<MapboxPlugProps> = (config) =>
394
+ const withAndroidAppGradle: ConfigPlugin<MapboxPlugProps> = (config, _props: MapboxPlugProps = {}) =>
395
395
  withAppBuildGradle(config, ({ modResults, ...exportedConfig }) => {
396
396
  if (modResults.language !== 'groovy') {
397
397
  WarningAggregator.addWarningAndroid(
@@ -407,7 +407,7 @@ const withAndroidAppGradle: ConfigPlugin<MapboxPlugProps> = (config) =>
407
407
  return { modResults, ...exportedConfig };
408
408
  });
409
409
 
410
- const withAndroidProjectGradle: ConfigPlugin<MapboxPlugProps> = (config) =>
410
+ const withAndroidProjectGradle: ConfigPlugin<MapboxPlugProps> = (config, _props: MapboxPlugProps = {}) =>
411
411
  withProjectBuildGradle(config, ({ modResults, ...exportedConfig }) => {
412
412
  if (modResults.language !== 'groovy') {
413
413
  WarningAggregator.addWarningAndroid(
@@ -430,7 +430,7 @@ const withMapboxAndroid: ConfigPlugin<MapboxPlugProps> = (
430
430
  RNMapboxMapsDownloadToken,
431
431
  RNMapboxMapsVersion,
432
432
  RNMapboxMapsUseV11,
433
- },
433
+ }: MapboxPlugProps = {},
434
434
  ) => {
435
435
  config = withAndroidProperties(config, {
436
436
  RNMapboxMapsImpl,
@@ -451,7 +451,7 @@ const withMapbox: ConfigPlugin<MapboxPlugProps> = (
451
451
  RNMapboxMapsVersion,
452
452
  RNMapboxMapsDownloadToken,
453
453
  RNMapboxMapsUseV11,
454
- },
454
+ }: MapboxPlugProps = {},
455
455
  ) => {
456
456
  config = withMapboxAndroid(config, {
457
457
  RNMapboxMapsImpl,
@@ -26,9 +26,16 @@ interface RNMBXModule {
26
26
  TileServers: {
27
27
  Mapbox: string;
28
28
  };
29
-
30
29
  removeCustomHeader(headerName: string): void;
31
- addCustomHeader(headerName: string, headerValue: string): void;
30
+ addCustomHeader(
31
+ headerName: string,
32
+ headerValue: string
33
+ ): void;
34
+ addCustomHeaderWithOptions(
35
+ headerName: string,
36
+ headerValue: string,
37
+ options: { urlRegexp?: string },
38
+ ): void;
32
39
  setAccessToken(accessToken: string | null): Promise<string | null>;
33
40
  setWellKnownTileServer(tileServer: string): void;
34
41
  clearData(): Promise<void>;
@@ -51,6 +58,24 @@ if (NativeModules.RNMBXModule == null) {
51
58
  }
52
59
  }
53
60
 
61
+ /**
62
+ * Add a custom header to HTTP requests.
63
+ * @param headerName - The name of the header
64
+ * @param headerValue - The value of the header
65
+ * @param options - Optional configuration. If provided with urlRegexp, the header will only be added to URLs matching the regex
66
+ */
67
+ function addCustomHeader(
68
+ headerName: string,
69
+ headerValue: string,
70
+ options?: { urlRegexp?: string },
71
+ ): void {
72
+ if (options) {
73
+ RNMBXModule.addCustomHeaderWithOptions(headerName, headerValue, options);
74
+ } else {
75
+ RNMBXModule.addCustomHeader(headerName, headerValue);
76
+ }
77
+ }
78
+
54
79
  export const {
55
80
  StyleURL,
56
81
  OfflinePackDownloadState,
@@ -58,7 +83,6 @@ export const {
58
83
  StyleSource,
59
84
  TileServers,
60
85
  removeCustomHeader,
61
- addCustomHeader,
62
86
  setAccessToken,
63
87
  setWellKnownTileServer,
64
88
  clearData,
@@ -66,3 +90,5 @@ export const {
66
90
  setTelemetryEnabled,
67
91
  setConnected,
68
92
  } = RNMBXModule;
93
+
94
+ export { addCustomHeader };
@@ -755,7 +755,7 @@ class MapView extends NativeBridgeComponent(
755
755
  * @example
756
756
  * this._map.queryRenderedFeaturesInRect([30, 40, 20, 10], ['==', 'type', 'Point'], ['id1', 'id2'])
757
757
  *
758
- * @param {Array<Number>} bbox - A rectangle expressed in the map view’s coordinate system. For v10, this can be an empty array to query the visible map area.
758
+ * @param {Array<Number>} bbox - A rectangle expressed in the map view’s coordinate system, density independent pixels and not map coordinates. This can be an empty array to query the visible map area.
759
759
  * @param {Array=} filter - 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.
760
760
  * @param {Array=} layerIDs - A array of layer id's to filter the features by
761
761
  * @return {FeatureCollection}