@rnmapbox/maps 10.0.13 → 10.0.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.
@@ -1,5 +1,5 @@
1
1
  def defaultMapboxMapsImpl = "maplibre"
2
- def defaultMapboxMapsVersion = "10.15.0"
2
+ def defaultMapboxMapsVersion = "10.15.1"
3
3
 
4
4
  def safeExtGet(prop, fallback) {
5
5
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
@@ -63,9 +63,12 @@ abstract class RCTLayer<T : Layer?>(protected var mContext: Context) : AbstractS
63
63
  return
64
64
  }
65
65
  mAboveLayerID = aboveLayerID
66
- if (mLayer != null) {
67
- removeFromMap(mMapView!!, RemovalReason.REORDER)
68
- addAbove(mAboveLayerID)
66
+ if (aboveLayerID == null) {
67
+ return
68
+ }
69
+ mMapView?.let {mapView ->
70
+ removeFromMap(mapView, RemovalReason.REORDER)
71
+ addAbove(mapView, aboveLayerID)
69
72
  }
70
73
  }
71
74
 
@@ -74,9 +77,12 @@ abstract class RCTLayer<T : Layer?>(protected var mContext: Context) : AbstractS
74
77
  return
75
78
  }
76
79
  mBelowLayerID = belowLayerID
77
- if (mLayer != null) {
78
- removeFromMap(mMapView!!,RemovalReason.REORDER)
79
- addBelow(mBelowLayerID)
80
+ if (belowLayerID == null) {
81
+ return
82
+ }
83
+ mMapView?.let { mapView ->
84
+ removeFromMap(mapView,RemovalReason.REORDER)
85
+ addBelow(mapView, belowLayerID)
80
86
  }
81
87
  }
82
88
 
@@ -159,28 +165,36 @@ abstract class RCTLayer<T : Layer?>(protected var mContext: Context) : AbstractS
159
165
  }
160
166
  }
161
167
 
162
- fun addAbove(aboveLayerID: String?) {
163
- mMapView!!.waitForLayer(aboveLayerID, object : FoundLayerCallback {
164
- override fun found(layer: Layer?) {
168
+ fun addAbove(mapView: RCTMGLMapView, aboveLayerID: String) {
169
+ mapView.waitForLayer(aboveLayerID, object : FoundLayerCallback {
170
+ override fun found(aboveLayer: Layer?) {
165
171
  if (!hasInitialized()) {
166
172
  return
167
173
  }
168
- if (style == null) return
169
- style!!.addLayerAbove(mLayer!!, aboveLayerID)
170
- mMapView!!.layerAdded(mLayer!!)
174
+ mapView.savedStyle?.let { style ->
175
+ mLayer?.let {layer ->
176
+ style.addLayerAbove(layer, aboveLayerID)
177
+ mapView.layerAdded(layer)
178
+ mMapView = mapView
179
+ }
180
+ }
171
181
  }
172
182
  })
173
183
  }
174
184
 
175
- fun addBelow(belowLayerID: String?) {
176
- mMapView!!.waitForLayer(belowLayerID, object : FoundLayerCallback {
177
- override fun found(layer: Layer?) {
185
+ fun addBelow(mapView: RCTMGLMapView, belowLayerID: String) {
186
+ mapView.waitForLayer(belowLayerID, object : FoundLayerCallback {
187
+ override fun found(belowLayer: Layer?) {
178
188
  if (!hasInitialized()) {
179
189
  return
180
190
  }
181
- if (style == null) return
182
- style!!.addLayerBelow(mLayer!!, belowLayerID)
183
- mMapView!!.layerAdded(mLayer!!)
191
+ mapView.savedStyle?.let { style ->
192
+ mLayer?.let { layer ->
193
+ style.addLayerBelow(layer, belowLayerID)
194
+ mapView.layerAdded(layer)
195
+ mMapView = mapView
196
+ }
197
+ }
184
198
  }
185
199
  })
186
200
  }
@@ -211,16 +225,20 @@ abstract class RCTLayer<T : Layer?>(protected var mContext: Context) : AbstractS
211
225
  if (style.styleLayerExists(id)) {
212
226
  return // prevent adding a layer twice
213
227
  }
214
- if (mAboveLayerID != null) {
215
- addAbove(mAboveLayerID)
216
- } else if (mBelowLayerID != null) {
217
- addBelow(mBelowLayerID)
218
- } else if (mLayerIndex != null) {
219
- addAtIndex(mLayerIndex!!)
220
- } else {
221
- add()
228
+ mMapView?.let { mapView ->
229
+ mLayer?.let { layer ->
230
+ mAboveLayerID?.also {
231
+ addAbove(mapView, it)
232
+ } ?: { mBelowLayerID?.also {
233
+ addBelow(mapView, it)
234
+ } ?: { mLayerIndex?.also {
235
+ addAtIndex(it)
236
+ } ?: {
237
+ add ()
238
+ } } }
239
+ }
240
+ setZoomBounds()
222
241
  }
223
- setZoomBounds()
224
242
  }
225
243
 
226
244
  protected fun setZoomBounds() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rnmapbox/maps",
3
3
  "description": "A Mapbox react native module for creating custom maps",
4
- "version": "10.0.13",
4
+ "version": "10.0.14",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },