@rnmapbox/maps 10.0.0-beta.30 → 10.0.0-beta.33

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.
@@ -0,0 +1,112 @@
1
+ name: Bug Report
2
+ description: This template should be used for reporting bugs and defects.
3
+ title: "[Bug]: "
4
+ labels: 'bug :beetle:'
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for taking the time to fill out this bug report!
10
+ - type: dropdown
11
+ id: mapbox-implementation
12
+ attributes:
13
+ label: Mapbox Implementation
14
+ description: |-
15
+ Check `RNMapboxMapsImpl` in your Podfile/gradle files. Defaults to `Maplibre`.
16
+ options:
17
+ - Mapbox
18
+ - Mapbox GL
19
+ - Maplibre
20
+ validations:
21
+ required: true
22
+ - type: input
23
+ id: mapbox-version
24
+ attributes:
25
+ label: Mapbox Version
26
+ description: |-
27
+ Check `RNMapboxMapsVersion` in your Podfile/gradle files, set to `default` if you don't cusomize the version
28
+ placeholder: 10.7.0
29
+ validations:
30
+ required: true
31
+ - type: dropdown
32
+ id: platform
33
+ attributes:
34
+ label: Platform
35
+ multiple: true
36
+ description: |-
37
+ The platform where you experience the issue
38
+ options:
39
+ - iOS
40
+ - Android
41
+ validations:
42
+ required: true
43
+ - type: input
44
+ id: rnmapbox-version
45
+ attributes:
46
+ label: "`@rnmapbox/maps` version"
47
+ description: |-
48
+ The version of `@rnmapbox/maps`, such as `#main`, `10.0.0-beta.32`
49
+ value: 10.0.0-beta.11
50
+ validations:
51
+ required: true
52
+ - type: textarea
53
+ attributes:
54
+ label: Standalone component to reproduce
55
+ description: |-
56
+ - Use [our BugReportTemplate](https://github.com/rnmapbox/maps/blob/main/example/src/examples/BugReportExample.js) screens as a starting point.
57
+ - Component should be self contained - no extra libraries, external data, no parameters
58
+ - Do not include setAccessToken or access token istelf.
59
+ value: |-
60
+ ```javascript
61
+ import React from 'react';
62
+ import {
63
+ MapView,
64
+ ShapeSource,
65
+ LineLayer,
66
+ Camera,
67
+ } from '@rnmapbox/maps';
68
+
69
+ const aLine = {
70
+ type: 'LineString',
71
+ coordinates: [
72
+ [-74.00597, 40.71427],
73
+ [-74.00697, 40.71527],
74
+ ],
75
+ };
76
+
77
+ class BugReportExample extends React.Component {
78
+ render() {
79
+ return (
80
+ <MapView style={{flex: 1}}>
81
+ <Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
82
+ <ShapeSource id="idStreetLayer" shape={aLine}>
83
+ <LineLayer id="idStreetLayer" />
84
+ </ShapeSource>
85
+ </MapView>
86
+ );
87
+ }
88
+ }
89
+ ```
90
+ validations:
91
+ required: true
92
+ - type: textarea
93
+ attributes:
94
+ label: Observed behavior and steps to reproduce
95
+ description: |-
96
+ - Please include as much evidence as possible (traces, videos, screenshots etc.)
97
+ - type: textarea
98
+ attributes:
99
+ label: Expected behavior
100
+ description: |-
101
+ - Please include the expected behavior and any resources supporting this expected behavior.
102
+ - type: textarea
103
+ attributes:
104
+ label: Notes / preliminary analysis
105
+ description: |-
106
+ - include your initial analysis, if available
107
+ - type: textarea
108
+ attributes:
109
+ label: Additional links and references
110
+ description: |-
111
+ - Links to traces, videos et
112
+
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npm run generate
5
+ npx lint-staged
@@ -34,10 +34,10 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
34
34
  private var mZoom: Double? = null
35
35
  private var mLatLng: LatLng? = null
36
36
  private var mBounds: LatLngBounds? = null
37
- private var mBoundsPaddingLeft = 0
38
- private var mBoundsPaddingRight = 0
39
- private var mBoundsPaddingBottom = 0
40
- private var mBoundsPaddingTop = 0
37
+ private var mBoundsPaddingLeft : Int? = null
38
+ private var mBoundsPaddingRight : Int? = null
39
+ private var mBoundsPaddingBottom : Int? = null
40
+ private var mBoundsPaddingTop : Int? = null
41
41
  private var mMode = CameraMode.EASE
42
42
  private var mDuration = 2000
43
43
  private var mCallback: Animator.AnimatorListener? = null
@@ -67,10 +67,10 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
67
67
 
68
68
  fun setBounds(
69
69
  bounds: LatLngBounds?,
70
- paddingLeft: Int,
71
- paddingRight: Int,
72
- paddingTop: Int,
73
- paddingBottom: Int
70
+ paddingLeft: Int?,
71
+ paddingRight: Int?,
72
+ paddingTop: Int?,
73
+ paddingBottom: Int?
74
74
  ) {
75
75
  mBounds = bounds
76
76
  mBoundsPaddingLeft = paddingLeft
@@ -95,6 +95,9 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
95
95
  val builder = CameraOptions.Builder()
96
96
  builder.center(currentCamera.center)
97
97
  builder.bearing(currentCamera.bearing)
98
+
99
+ val currentPadding = currentCamera.padding;
100
+
98
101
  builder.padding(currentCamera.padding)
99
102
  builder.zoom(currentCamera.zoom)
100
103
  if (mBearing != null) {
@@ -109,16 +112,11 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
109
112
  val tilt = if (mTilt != null) mTilt!! else currentCamera.pitch
110
113
  val bearing = if (mBearing != null) mBearing!! else currentCamera.bearing
111
114
 
112
- // Adding map padding to the camera padding which is the same behavior as
113
- // mapbox native does on iOS
114
- val contentInset = map.cameraState.padding
115
- val paddingLeft =
116
- java.lang.Double.valueOf(contentInset.left + mBoundsPaddingLeft).toInt()
117
- val paddingTop = java.lang.Double.valueOf(contentInset.top + mBoundsPaddingTop).toInt()
118
- val paddingRight =
119
- java.lang.Double.valueOf(contentInset.right + mBoundsPaddingRight).toInt()
120
- val paddingBottom =
121
- java.lang.Double.valueOf(contentInset.bottom + mBoundsPaddingBottom).toInt()
115
+ val paddingLeft: Int = mBoundsPaddingLeft ?: currentPadding.left.toInt()
116
+ val paddingTop: Int = mBoundsPaddingTop ?: currentPadding.top.toInt()
117
+ val paddingRight: Int = mBoundsPaddingRight ?: currentPadding.right.toInt()
118
+ val paddingBottom: Int = mBoundsPaddingBottom ?: currentPadding.bottom.toInt()
119
+
122
120
  val cameraPadding = intArrayOf(paddingLeft, paddingTop, paddingRight, paddingBottom)
123
121
  val cameraPaddingClipped = clippedPadding(cameraPadding, mapView)
124
122
  val boundsCamera = map.cameraForCoordinateBounds(
@@ -163,18 +161,12 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
163
161
  stop.setDuration(readableMap.getInt("duration"))
164
162
  }
165
163
  if (readableMap.hasKey("bounds")) {
166
- var paddingTop = getBoundsPaddingByKey(readableMap, "paddingTop")
167
- var paddingRight = getBoundsPaddingByKey(readableMap, "paddingRight")
168
- var paddingBottom = getBoundsPaddingByKey(readableMap, "paddingBottom")
169
- var paddingLeft = getBoundsPaddingByKey(readableMap, "paddingLeft")
170
-
171
- // scale padding by pixel ratio
172
164
  val metrics = context.resources.displayMetrics
173
- paddingTop = java.lang.Float.valueOf(paddingTop * metrics.scaledDensity).toInt()
174
- paddingRight = java.lang.Float.valueOf(paddingRight * metrics.scaledDensity).toInt()
175
- paddingBottom =
176
- java.lang.Float.valueOf(paddingBottom * metrics.scaledDensity).toInt()
177
- paddingLeft = java.lang.Float.valueOf(paddingLeft * metrics.scaledDensity).toInt()
165
+ var paddingTop = getBoundsPaddingByKey(readableMap, metrics.scaledDensity, "paddingTop")
166
+ var paddingRight = getBoundsPaddingByKey(readableMap, metrics.scaledDensity, "paddingRight")
167
+ var paddingBottom = getBoundsPaddingByKey(readableMap, metrics.scaledDensity, "paddingBottom")
168
+ var paddingLeft = getBoundsPaddingByKey(readableMap, metrics.scaledDensity, "paddingLeft")
169
+
178
170
  val collection = FeatureCollection.fromJson(readableMap.getString("bounds")!!)
179
171
  stop.setBounds(
180
172
  toLatLngBounds(collection), paddingLeft, paddingRight,
@@ -221,8 +213,12 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
221
213
  return intArrayOf(resultLeft, resultTop, resultRight, resultBottom)
222
214
  }
223
215
 
224
- private fun getBoundsPaddingByKey(map: ReadableMap, key: String): Int {
225
- return if (map.hasKey(key)) map.getInt(key) else 0
216
+ private fun getBoundsPaddingByKey(map: ReadableMap, scaledDensity: Float, key: String): Int? {
217
+ if (map.hasKey(key)) {
218
+ return (map.getInt(key) * scaledDensity).toInt()
219
+ } else {
220
+ return null;
221
+ }
226
222
  }
227
223
  }
228
224
  }
@@ -20,8 +20,10 @@ import com.mapbox.maps.extension.style.layers.Layer
20
20
  import com.mapbox.maps.extension.style.layers.generated.*
21
21
  import com.mapbox.maps.extension.style.layers.getLayer
22
22
  import com.mapbox.maps.extension.style.layers.properties.generated.Visibility
23
+ import com.mapbox.maps.plugin.annotation.Annotation
23
24
  import com.mapbox.maps.plugin.annotation.annotations
24
25
  import com.mapbox.maps.plugin.annotation.generated.OnPointAnnotationClickListener
26
+ import com.mapbox.maps.plugin.annotation.generated.OnPointAnnotationDragListener
25
27
  import com.mapbox.maps.plugin.annotation.generated.PointAnnotation
26
28
  import com.mapbox.maps.plugin.annotation.generated.PointAnnotationManager
27
29
  import com.mapbox.maps.plugin.annotation.generated.createPointAnnotationManager
@@ -79,6 +81,7 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
79
81
  private val mHandledMapChangedEvents: HashSet<String>? = null
80
82
  private var mOffscreenAnnotationViewContainer: ViewGroup? = null
81
83
  private var mAnnotationClicked = false
84
+ private var mAnnotationDragged = false
82
85
  private var mLocationComponentManager: LocationComponentManager? = null
83
86
  var tintColor: Int? = null
84
87
  private set
@@ -89,6 +92,7 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
89
92
  val _this = this
90
93
  val gesturesPlugin: GesturesPlugin = this.gestures
91
94
  gesturesPlugin.removeOnMapClickListener(_this)
95
+ gesturesPlugin.removeOnMapLongClickListener(_this)
92
96
 
93
97
  mPointAnnotationManager = annotations.createPointAnnotationManager()
94
98
  mPointAnnotationManager?.addClickListener(OnPointAnnotationClickListener { pointAnnotation ->
@@ -96,7 +100,47 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
96
100
  false
97
101
  }
98
102
  )
103
+ mPointAnnotationManager?.addDragListener(object : OnPointAnnotationDragListener {
104
+ override fun onAnnotationDragStarted(_annotation: Annotation<*>) {
105
+ mAnnotationDragged = true;
106
+ var reactAnnotation: RCTMGLPointAnnotation? = null
107
+ for (key in mPointAnnotations.keys) {
108
+ val annotation = mPointAnnotations[key]
109
+ val curMarkerID = annotation?.mapboxID
110
+ if (_annotation.id == curMarkerID) {
111
+ reactAnnotation = annotation
112
+ }
113
+ }
114
+ reactAnnotation?.let { it.onDragStart() }
115
+ }
116
+
117
+ override fun onAnnotationDrag(_annotation: Annotation<*>) {
118
+ var reactAnnotation: RCTMGLPointAnnotation? = null
119
+ for (key in mPointAnnotations.keys) {
120
+ val annotation = mPointAnnotations[key]
121
+ val curMarkerID = annotation?.mapboxID
122
+ if (_annotation.id == curMarkerID) {
123
+ reactAnnotation = annotation
124
+ }
125
+ }
126
+ reactAnnotation?.let { it.onDrag() }
127
+ }
128
+
129
+ override fun onAnnotationDragFinished(_annotation: Annotation<*>) {
130
+ mAnnotationDragged = false;
131
+ var reactAnnotation: RCTMGLPointAnnotation? = null
132
+ for (key in mPointAnnotations.keys) {
133
+ val annotation = mPointAnnotations[key]
134
+ val curMarkerID = annotation?.mapboxID
135
+ if (_annotation.id == curMarkerID) {
136
+ reactAnnotation = annotation
137
+ }
138
+ }
139
+ reactAnnotation?.let { it.onDragEnd() }
140
+ }
141
+ })
99
142
  gesturesPlugin.addOnMapClickListener(_this)
143
+ gesturesPlugin.addOnMapLongClickListener(_this)
100
144
 
101
145
  }
102
146
  return mPointAnnotationManager
@@ -106,7 +150,6 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
106
150
  map.getStyle(object : Style.OnStyleLoaded {
107
151
  override fun onStyleLoaded(style: Style) {
108
152
  savedStyle = style
109
- createSymbolManager(style)
110
153
  setUpImage(style)
111
154
  addQueuedFeatures()
112
155
  setupLocalization(style)
@@ -426,6 +469,10 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
426
469
 
427
470
  override fun onMapLongClick(point: Point): Boolean {
428
471
  val _this = this
472
+ if (mAnnotationDragged) {
473
+ mAnnotationDragged = false
474
+ return true
475
+ }
429
476
  val screenPoint = mMap?.pixelForCoordinate(point)
430
477
  if (screenPoint != null) {
431
478
  val event = MapClickEvent(_this, LatLng(point), screenPoint, EventTypes.MAP_LONG_CLICK)
@@ -534,52 +581,6 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
534
581
  return GeoJSONUtils.toPointFeature(latLng, properties)
535
582
  }
536
583
 
537
- fun createSymbolManager(style: Style?) {
538
- /*
539
- v10 TODO
540
- symbolManager = new SymbolManager(this, mMap, style);
541
- symbolManager.setIconAllowOverlap(true);
542
- symbolManager.addClickListener(new OnSymbolClickListener() {
543
- @Override
544
- public void onAnnotationClick(Symbol symbol) {
545
- onMarkerClick(symbol);
546
- }
547
- });
548
- symbolManager.addDragListener(new OnSymbolDragListener() {
549
- @Override
550
- public void onAnnotationDragStarted(Symbol symbol) {
551
- mAnnotationClicked = true;
552
- final long selectedMarkerID = symbol.getId();
553
- RCTMGLPointAnnotation annotation = getPointAnnotationByMarkerID(selectedMarkerID);
554
- if (annotation != null) {
555
- annotation.onDragStart();
556
- }
557
- }
558
-
559
- @Override
560
- public void onAnnotationDrag(Symbol symbol) {
561
- final long selectedMarkerID = symbol.getId();
562
- RCTMGLPointAnnotation annotation = getPointAnnotationByMarkerID(selectedMarkerID);
563
- if (annotation != null) {
564
- annotation.onDrag();
565
- }
566
- }
567
-
568
- @Override
569
- public void onAnnotationDragFinished(Symbol symbol) {
570
- mAnnotationClicked = false;
571
- final long selectedMarkerID = symbol.getId();
572
- RCTMGLPointAnnotation annotation = getPointAnnotationByMarkerID(selectedMarkerID);
573
- if (annotation != null) {
574
- annotation.onDragEnd();
575
- }
576
- }
577
- });
578
- mMap.addOnMapClickListener(this);
579
- mMap.addOnMapLongClickListener(this);
580
- */
581
- }
582
-
583
584
  fun addQueuedFeatures() {
584
585
  if (mQueuedFeatures != null && mQueuedFeatures!!.size > 0) {
585
586
  for (i in mQueuedFeatures!!.indices) {
@@ -12,7 +12,11 @@ Custom headers are implemented using OkHttp interseptor for android and method s
12
12
 
13
13
  None
14
14
 
15
- #### IOS
15
+ #### IOS with Mapbox-v10
16
+
17
+ None
18
+
19
+ #### IOS with Mapbox GL or Mapblibre
16
20
 
17
21
  To enable this on iOS you need to call `[[MGLCustomHeaders sharedInstance] initHeaders]` pretty early in the lifecycle of the application. This will swizzle the custom method.
18
22
  Suggested location is `[AppDelegate application: didFinishLaunchingWithOptions:]`
package/index.d.ts CHANGED
@@ -38,6 +38,8 @@ import type {
38
38
  MapboxGLEvent as _MapboxGLEvent,
39
39
  UserTrackingMode as _UserTrackingMode,
40
40
  UserTrackingModeChangeCallback as _UserTrackingModeChangeCallback,
41
+ AnimatedPoint as _AnimatedPoint,
42
+ AnimatedLineString as _AnimatedLineString,
41
43
  } from './javascript/types/index';
42
44
  import type { requestAndroidLocationPermissions as _requestAndroidLocationPermissions } from './javascript/requestAndroidLocationPermissions';
43
45
 
@@ -204,6 +206,28 @@ declare namespace MapboxGL {
204
206
  visibleBounds: number[];
205
207
  },
206
208
  ): void;
209
+
210
+ class AnimatedPoint {
211
+ constructor(point?: AnimatedPoint);
212
+ longitude: ReactNative.Animated.Value;
213
+ latitude: ReactNative.Animated.Value;
214
+ setValue: (point: GeoJSON.Point) => void;
215
+ setOffset: (point: GeoJSON.Point) => void;
216
+ flattenOffset: () => void;
217
+ stopAnimation: (cb?: () => GeoJSON.Point) => void;
218
+ addListener: (cb?: () => GeoJSON.Point) => void;
219
+ removeListener: (id: string) => void;
220
+ spring: (
221
+ config: Record<string, any>,
222
+ ) => ReactNative.Animated.CompositeAnimation;
223
+ timing: (
224
+ config: Record<string, any>,
225
+ ) => ReactNative.Animated.CompositeAnimation;
226
+ }
227
+
228
+ class AnimatedShape {
229
+ constructor(shape: AnimatedLineString);
230
+ }
207
231
  }
208
232
 
209
233
  namespace Animated {
@@ -221,28 +245,6 @@ declare namespace MapboxGL {
221
245
  class BackgroundLayer extends Component<BackgroundLayerProps> {}
222
246
  }
223
247
 
224
- /**
225
- * Classes
226
- */
227
-
228
- class AnimatedPoint {
229
- constructor(point?: GeoJSON.Point);
230
- longitude: ReactNative.Animated.Value;
231
- latitude: ReactNative.Animated.Value;
232
- setValue: (point: GeoJSON.Point) => void;
233
- setOffset: (point: GeoJSON.Point) => void;
234
- flattenOffset: () => void;
235
- stopAnimation: (cb?: () => GeoJSON.Point) => void;
236
- addListener: (cb?: () => GeoJSON.Point) => void;
237
- removeListener: (id: string) => void;
238
- spring: (
239
- config: Record<string, any>,
240
- ) => ReactNative.Animated.CompositeAnimation;
241
- timing: (
242
- config: Record<string, any>,
243
- ) => ReactNative.Animated.CompositeAnimation;
244
- }
245
-
246
248
  /**
247
249
  * Components
248
250
  */
@@ -1037,13 +1039,22 @@ export import CameraAnimationMode = MapboxGL.CameraAnimationMode;
1037
1039
  export import Atmosphere = MapboxGL.Atmosphere;
1038
1040
  export import Terrain = MapboxGL.Terrain;
1039
1041
  export import RasterDemSource = MapboxGL.RasterDemSource;
1040
- export import SkyLayer = MapboxGL.SkyLayer;
1041
1042
  export import ShapeSource = MapboxGL.ShapeSource;
1043
+ export import FillLayer = MapboxGL.FillLayer;
1044
+ export import FillExtrusionLayer = MapboxGL.FillExtrusionLayer;
1045
+ export import HeatmapLayer = MapboxGL.HeatmapLayer;
1046
+ export import LineLayer = MapboxGL.LineLayer;
1042
1047
  export import CircleLayer = MapboxGL.CircleLayer;
1048
+ export import SkyLayer = MapboxGL.SkyLayer;
1049
+ export import SymbolLayer = MapboxGL.SymbolLayer;
1050
+ export import RasterLayer = MapboxGL.RasterLayer;
1051
+ export import BackgroundLayer = MapboxGL.BackgroundLayer;
1043
1052
 
1044
1053
  export import MapboxGLEvent = MapboxGL.MapboxGLEvent;
1045
1054
  export import UserTrackingMode = MapboxGL.UserTrackingMode;
1046
1055
  export import UserTrackingModeChangeCallback = MapboxGL.UserTrackingModeChangeCallback;
1056
+ export import AnimatedPoint = MapboxGL.AnimatedPoint;
1057
+ export import AnimatedShape = MapboxGL.AnimatedShape;
1047
1058
 
1048
1059
  export const { offlineManager } = MapboxGL;
1049
1060
 
@@ -0,0 +1,39 @@
1
+ import MapboxMaps
2
+
3
+ class CustomHttpHeaders : HttpServiceInterceptorInterface {
4
+ static var shared : CustomHttpHeaders = {
5
+ let headers = CustomHttpHeaders()
6
+ headers.install()
7
+ return headers
8
+ }()
9
+
10
+ var customHeaders : [String:String] = [:]
11
+
12
+ func install() {
13
+ HttpServiceFactory.getInstance().setInterceptorForInterceptor(self)
14
+ }
15
+
16
+ func reset() {
17
+ HttpServiceFactory.getInstance().setInterceptorForInterceptor(nil)
18
+ }
19
+
20
+ // MARK: - HttpServiceInterceptorInterface
21
+
22
+ func onRequest(for request: HttpRequest) -> HttpRequest {
23
+ customHeaders.forEach {(key, value) in
24
+ request.headers[key] = value
25
+ }
26
+ return request
27
+ }
28
+
29
+ func onDownload(forDownload download: DownloadOptions) -> DownloadOptions {
30
+ customHeaders.forEach {(key,value) in
31
+ download.request.headers[key] = value
32
+ }
33
+ return download
34
+ }
35
+
36
+ func onResponse(for response: HttpResponse) -> HttpResponse {
37
+ return response
38
+ }
39
+ }
@@ -4,4 +4,7 @@
4
4
 
5
5
  RCT_EXTERN_METHOD(setAccessToken:)
6
6
 
7
+ RCT_EXTERN_METHOD(addCustomHeader:(NSString *)headerName forHeaderValue:(NSString *) headerValue)
8
+ RCT_EXTERN_METHOD(removeCustomHeader:(NSString *)headerName)
9
+
7
10
  @end
@@ -68,4 +68,12 @@ class MGLModule : NSObject {
68
68
  @objc func setAccessToken(_ token: String) {
69
69
  MGLModule.accessToken = token
70
70
  }
71
+
72
+ @objc func addCustomHeader(_ headerName: String, forHeaderValue headerValue: String ) {
73
+ CustomHttpHeaders.shared.customHeaders[headerName] = headerValue
74
+ }
75
+
76
+ @objc func removeCustomHeader(_ headerName: String) {
77
+ CustomHttpHeaders.shared.customHeaders[headerName] = nil
78
+ }
71
79
  }
@@ -321,26 +321,24 @@ class RCTMGLOfflineModule: RCTEventEmitter {
321
321
  func createPack(_ options: NSDictionary, resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
322
322
  DispatchQueue.main.async {
323
323
  do {
324
+ let metadataStr = options["metadata"] as! String
325
+ let metadata = try JSONSerialization.jsonObject(with: metadataStr.data(using: .utf8)!, options: []) as! [String:Any]
326
+ let id = metadata["name"] as! String
327
+ let stylePackLoadOptions = StylePackLoadOptions(glyphsRasterizationMode: .ideographsRasterizedLocally, metadata: metadata)
328
+
324
329
  let boundsStr = options["bounds"] as! String
325
330
  let boundsData = boundsStr.data(using: .utf8)
326
331
  var boundsFC = try JSONDecoder().decode(FeatureCollection.self, from: boundsData!)
327
332
 
328
333
  var bounds = self.convertPointPairToBounds(RCTMGLFeatureUtils.fcToGeomtry(boundsFC))
329
-
334
+
330
335
  let descriptorOptions = TilesetDescriptorOptions(
331
- styleURI: options["styleURL"] as! String,
332
- minZoom: (options["minZoom"] as! NSNumber).uint8Value,
333
- maxZoom: (options["maxZoom"] as! NSNumber).uint8Value,
334
- stylePack: nil
336
+ styleURI: StyleURI(rawValue: options["styleURL"] as! String)!,
337
+ zoomRange: (options["minZoom"] as! NSNumber).uint8Value...(options["maxZoom"] as! NSNumber).uint8Value,
338
+ stylePackOptions: stylePackLoadOptions
335
339
  )
336
340
  let tilesetDescriptor = self.offlineManager.createTilesetDescriptor(for: descriptorOptions)
337
-
338
-
339
- let metadataStr = options["metadata"] as! String
340
-
341
- let metadata = try JSONSerialization.jsonObject(with: metadataStr.data(using: .utf8)!, options: []) as! [String:Any]
342
341
 
343
- let id = metadata["name"] as! String
344
342
  let loadOptions = TileRegionLoadOptions(
345
343
  geometry: bounds, // RCTMGLFeatureUtils.geometryToGeometry(bounds),
346
344
  descriptors: [tilesetDescriptor],
@@ -375,7 +373,7 @@ class RCTMGLOfflineModule: RCTEventEmitter {
375
373
  self.offlinePackDidReceiveError(name: id, error: error)
376
374
  }
377
375
  }
378
-
376
+
379
377
  self.tileRegionPacks[id]!.cancelable = task
380
378
  resolver([
381
379
  "bounds": boundsStr,
@@ -1,4 +1,6 @@
1
1
  import { SyntheticEvent } from 'react';
2
+ import { Animated } from 'react-native';
3
+ import { GeoJsonObject } from 'geojson';
2
4
 
3
5
  // General.
4
6
 
@@ -21,3 +23,15 @@ export type UserTrackingModeChangeCallback = (
21
23
  }
22
24
  >,
23
25
  ) => void;
26
+
27
+ // Animated.
28
+
29
+ export interface AnimatedPoint extends GeoJsonObject {
30
+ readonly type: 'Point';
31
+ coordinates: (Animated.Value | number)[];
32
+ }
33
+
34
+ export interface AnimatedLineString extends GeoJsonObject {
35
+ readonly type: 'LineString';
36
+ coordinates: (Animated.Value | number)[][];
37
+ }
@@ -1,4 +1,4 @@
1
- import { processColor, Image } from 'react-native';
1
+ import { Image, processColor } from 'react-native';
2
2
 
3
3
  import { getStyleType } from './styleMap';
4
4
  import BridgeValue from './BridgeValue';