@rnmapbox/maps 10.0.0-beta.47 → 10.0.0-beta.48

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.
@@ -72,8 +72,8 @@ class RCTMGLCamera(private val mContext: Context, private val mManager: RCTMGLCa
72
72
  private var mFollowZoomLevel : Double? = null
73
73
  private var mFollowHeading : Double? = null
74
74
  private var mZoomLevel = -1.0
75
- private var mMinZoomLevel = -1.0
76
- private var mMaxZoomLevel = -1.0
75
+ private var mMinZoomLevel : Double? = null
76
+ private var mMaxZoomLevel : Double? = null
77
77
  private var mMaxBounds: LatLngBounds? = null
78
78
  private var mFollowUserLocation = false
79
79
  private var mFollowUserMode: String? = null
@@ -120,7 +120,6 @@ class RCTMGLCamera(private val mContext: Context, private val mManager: RCTMGLCa
120
120
  override fun addToMap(mapView: RCTMGLMapView) {
121
121
  super.addToMap(mapView)
122
122
  setInitialCamera()
123
- updateMaxMinZoomLevel()
124
123
  updateMaxBounds()
125
124
  mCameraStop?.let { updateCamera(it) }
126
125
  if (mFollowUserLocation) {
@@ -169,30 +168,17 @@ class RCTMGLCamera(private val mContext: Context, private val mManager: RCTMGLCa
169
168
  withMapView { mapView ->
170
169
  val map = mapView.getMapboxMap()
171
170
  val maxBounds = mMaxBounds
171
+ val builder = CameraBoundsOptions.Builder()
172
+
172
173
  if (maxBounds != null) {
173
- map.setBounds(CameraBoundsOptions.Builder().bounds(
174
- maxBounds.toBounds()
175
- ).build())
176
- } else {
177
- map.setBounds(CameraBoundsOptions.Builder().build())
174
+ builder.bounds(maxBounds.toBounds())
178
175
  }
179
-
176
+ mMinZoomLevel?.let { builder.minZoom(it) }
177
+ mMaxZoomLevel?.let { builder.maxZoom(it) }
178
+ map.setBounds(builder.build())
180
179
  }
181
180
  }
182
181
 
183
- private fun updateMaxMinZoomLevel() {
184
- /*
185
- MapboxMap map = getMapboxMap();
186
- if (map != null) {
187
- if (mMinZoomLevel >= 0.0) {
188
- map.setMinZoomPreference(mMinZoomLevel);
189
- }
190
- if (mMaxZoomLevel >= 0.0) {
191
- map.setMaxZoomPreference(mMaxZoomLevel);
192
- }
193
- }*/
194
- }
195
-
196
182
  private fun setInitialCamera() {
197
183
  val map = mMapView!!.getMapboxMap()
198
184
  if (mDefaultStop != null) {
@@ -332,14 +318,14 @@ class RCTMGLCamera(private val mContext: Context, private val mManager: RCTMGLCa
332
318
  }
333
319
  }
334
320
 
335
- fun setMinZoomLevel(zoomLevel: Double) {
321
+ fun setMinZoomLevel(zoomLevel: Double?) {
336
322
  mMinZoomLevel = zoomLevel
337
- updateMaxMinZoomLevel()
323
+ updateMaxBounds()
338
324
  }
339
325
 
340
- fun setMaxZoomLevel(zoomLevel: Double) {
326
+ fun setMaxZoomLevel(zoomLevel: Double?) {
341
327
  mMaxZoomLevel = zoomLevel
342
- updateMaxMinZoomLevel()
328
+ updateMaxBounds()
343
329
  }
344
330
 
345
331
  fun setZoomLevel(zoomLevel: Double) {
@@ -26,14 +26,9 @@ import com.mapbox.maps.extension.style.layers.getLayer
26
26
  import com.mapbox.maps.extension.style.layers.properties.generated.Visibility
27
27
  import com.mapbox.maps.plugin.annotation.Annotation
28
28
  import com.mapbox.maps.plugin.annotation.annotations
29
- import com.mapbox.maps.plugin.annotation.generated.OnPointAnnotationClickListener
30
- import com.mapbox.maps.plugin.annotation.generated.OnPointAnnotationDragListener
31
- import com.mapbox.maps.plugin.annotation.generated.PointAnnotation
32
- import com.mapbox.maps.plugin.annotation.generated.PointAnnotationManager
33
- import com.mapbox.maps.plugin.annotation.generated.createPointAnnotationManager
29
+ import com.mapbox.maps.plugin.annotation.generated.*
34
30
  import com.mapbox.maps.plugin.attribution.attribution
35
31
  import com.mapbox.maps.plugin.attribution.generated.AttributionSettings
36
- import com.mapbox.maps.plugin.scalebar.scalebar
37
32
  import com.mapbox.maps.plugin.compass.compass
38
33
  import com.mapbox.maps.plugin.compass.generated.CompassSettings
39
34
  import com.mapbox.maps.plugin.delegates.listeners.*
@@ -41,7 +36,7 @@ import com.mapbox.maps.plugin.gestures.*
41
36
  import com.mapbox.maps.plugin.logo.generated.LogoSettings
42
37
  import com.mapbox.maps.plugin.logo.logo
43
38
  import com.mapbox.maps.plugin.scalebar.generated.ScaleBarSettings
44
- import com.mapbox.maps.viewannotation.ViewAnnotationManager
39
+ import com.mapbox.maps.plugin.scalebar.scalebar
45
40
  import com.mapbox.rctmgl.R
46
41
  import com.mapbox.rctmgl.components.AbstractMapFeature
47
42
  import com.mapbox.rctmgl.components.annotation.RCTMGLMarkerView
@@ -60,6 +55,7 @@ import com.mapbox.rctmgl.events.IEvent
60
55
  import com.mapbox.rctmgl.events.MapChangeEvent
61
56
  import com.mapbox.rctmgl.events.MapClickEvent
62
57
  import com.mapbox.rctmgl.events.constants.EventTypes
58
+ import com.mapbox.rctmgl.utils.BitmapUtils
63
59
  import com.mapbox.rctmgl.utils.GeoJSONUtils
64
60
  import com.mapbox.rctmgl.utils.LatLng
65
61
  import com.mapbox.rctmgl.utils.Logger
@@ -68,6 +64,7 @@ import org.json.JSONException
68
64
  import org.json.JSONObject
69
65
  import java.util.*
70
66
 
67
+
71
68
  data class OrnamentSettings(
72
69
  var enabled : Boolean? = false,
73
70
  var margins: ReadableMap? =null,
@@ -398,6 +395,7 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
398
395
  }
399
396
 
400
397
  fun setReactStyleURL(styleURL: String) {
398
+ mStyleURL = styleURL
401
399
  if (mMap != null) {
402
400
  removeAllFeaturesFromMap()
403
401
  if (isJSONValid(mStyleURL)) {
@@ -733,7 +731,8 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
733
731
  }
734
732
 
735
733
  fun queryRenderedFeaturesInRect(callbackID: String?, rect: RectF, filter: Expression?, layerIDs: List<String>?) {
736
- val screenBox = ScreenBox(
734
+ val size = mMap!!.getMapOptions().size
735
+ val screenBox = if (rect.isEmpty()) ScreenBox(ScreenCoordinate(0.0, 0.0), ScreenCoordinate(size?.width!!.toDouble(), size?.height!!.toDouble())) else ScreenBox(
737
736
  ScreenCoordinate(rect.right.toDouble(), rect.bottom.toDouble() ),
738
737
  ScreenCoordinate(rect.left.toDouble(), rect.top.toDouble()),
739
738
  )
@@ -773,6 +772,28 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
773
772
  })
774
773
  }
775
774
 
775
+ fun takeSnap(callbackID: String?, writeToDisk: Boolean) {
776
+ this.snapshot { snapshot ->
777
+ if (snapshot == null) {
778
+ Logger.e("takeSnap", "snapshot failed")
779
+
780
+ sendResponse(callbackID, {
781
+ it.putNull("data")
782
+ it.putString("error", "no snapshot")
783
+ })
784
+ } else {
785
+ val uri: String = if (writeToDisk) BitmapUtils.createTempFile(
786
+ mContext,
787
+ snapshot
788
+ ) else BitmapUtils.createBase64(snapshot)
789
+
790
+ sendResponse(callbackID, {
791
+ it.putString("uri", uri)
792
+ })
793
+ }
794
+ }
795
+ }
796
+
776
797
  fun queryTerrainElevation(callbackID: String?, longitude: Double, latitude: Double) {
777
798
  val result = mMap?.getElevation(Point.fromLngLat(longitude, latitude))
778
799
 
@@ -870,8 +891,8 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
870
891
  private fun toGravity(kind: String, viewPosition: Int): Int {
871
892
  return when (viewPosition) {
872
893
  0 -> (Gravity.TOP or Gravity.LEFT)
873
- 1 -> (Gravity.BOTTOM or Gravity.LEFT)
874
- 2 -> (Gravity.TOP or Gravity.RIGHT)
894
+ 1 -> (Gravity.TOP or Gravity.RIGHT)
895
+ 2 -> (Gravity.BOTTOM or Gravity.LEFT)
875
896
  3 -> (Gravity.BOTTOM or Gravity.RIGHT)
876
897
  else -> {
877
898
  Logger.e(
@@ -959,7 +980,7 @@ open class RCTMGLMapView(private val mContext: Context, var mManager: RCTMGLMapV
959
980
  mScaleBarSettings.enabled = scaleBarEnabled
960
981
  updateScaleBar()
961
982
  }
962
-
983
+
963
984
  fun setReactScaleBarViewMargins(scaleBarMargins: ReadableMap) {
964
985
  mScaleBarSettings.margins = scaleBarMargins
965
986
  updateScaleBar()
@@ -273,6 +273,9 @@ open class RCTMGLMapViewManager(context: ReactApplicationContext?) :
273
273
  METHOD_VISIBLE_BOUNDS -> {
274
274
  mapView.getVisibleBounds(args!!.getString(0));
275
275
  }
276
+ METHOD_TAKE_SNAP -> {
277
+ mapView.takeSnap(args!!.getString(0), args!!.getBoolean(1))
278
+ }
276
279
  }
277
280
  /*
278
281
  switch (commandID) {
@@ -217,7 +217,7 @@ public class ConvertUtils {
217
217
  public static RectF toRectF(ReadableArray array) {
218
218
  RectF rectF = new RectF();
219
219
 
220
- if (array == null) {
220
+ if (array == null || array.size() == 0) {
221
221
  return rectF;
222
222
  }
223
223
 
package/docs/MapView.md CHANGED
@@ -118,12 +118,12 @@ this._map.queryRenderedFeaturesAtPoint([30, 40], ['==', 'type', 'Point'], ['id1'
118
118
 
119
119
  ### queryRenderedFeaturesInRect(bbox[, filter][, layerIDs])
120
120
 
121
- Returns an array of rendered map features that intersect with the given rectangle,<br/>restricted to the given style layers and filtered by the given predicate.
121
+ Returns an array of rendered map features that intersect with the given rectangle,<br/>restricted to the given style layers and filtered by the given predicate. In v10,<br/>passing an empty array will query the entire visible bounds of the map.
122
122
 
123
123
  #### arguments
124
124
  | Name | Type | Required | Description |
125
125
  | ---- | :--: | :------: | :----------: |
126
- | `bbox` | `Array` | `Yes` | A rectangle expressed in the map view’s coordinate system. |
126
+ | `bbox` | `Array` | `Yes` | A rectangle expressed in the map view’s coordinate system. For v10, this can be an empty array to query the visible map area. |
127
127
  | `filter` | `Array` | `No` | 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. |
128
128
  | `layerIDs` | `Array` | `No` | A array of layer id's to filter the features by |
129
129
 
package/docs/docs.json CHANGED
@@ -2733,14 +2733,14 @@
2733
2733
  },
2734
2734
  {
2735
2735
  "name": "queryRenderedFeaturesInRect",
2736
- "docblock": "Returns an array of rendered map features that intersect with the given rectangle,\nrestricted to the given style layers and filtered by the given predicate.\n\n@example\nthis._map.queryRenderedFeaturesInRect([30, 40, 20, 10], ['==', 'type', 'Point'], ['id1', 'id2'])\n\n@param {Array<Number>} bbox - A rectangle expressed in the map view’s coordinate system.\n@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.\n@param {Array=} layerIDs - A array of layer id's to filter the features by\n@return {FeatureCollection}",
2736
+ "docblock": "Returns an array of rendered map features that intersect with the given rectangle,\nrestricted to the given style layers and filtered by the given predicate. In v10,\npassing an empty array will query the entire visible bounds of the map.\n\n@example\nthis._map.queryRenderedFeaturesInRect([30, 40, 20, 10], ['==', 'type', 'Point'], ['id1', 'id2'])\n\n@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.\n@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.\n@param {Array=} layerIDs - A array of layer id's to filter the features by\n@return {FeatureCollection}",
2737
2737
  "modifiers": [
2738
2738
  "async"
2739
2739
  ],
2740
2740
  "params": [
2741
2741
  {
2742
2742
  "name": "bbox",
2743
- "description": "A rectangle expressed in the map view’s coordinate system.",
2743
+ "description": "A rectangle expressed in the map view’s coordinate system. For v10, this can be an empty array to query the visible map area.",
2744
2744
  "type": {
2745
2745
  "name": "Array"
2746
2746
  },
@@ -2769,7 +2769,7 @@
2769
2769
  "name": "FeatureCollection"
2770
2770
  }
2771
2771
  },
2772
- "description": "Returns an array of rendered map features that intersect with the given rectangle,\nrestricted to the given style layers and filtered by the given predicate.",
2772
+ "description": "Returns an array of rendered map features that intersect with the given rectangle,\nrestricted to the given style layers and filtered by the given predicate. In v10,\npassing an empty array will query the entire visible bounds of the map.",
2773
2773
  "examples": [
2774
2774
  "\nthis._map.queryRenderedFeaturesInRect([30, 40, 20, 10], ['==', 'type', 'Point'], ['id1', 'id2'])\n\n"
2775
2775
  ]
@@ -138,8 +138,12 @@ class RCTMGLCamera : RCTMGLMapComponentBase, LocationConsumer {
138
138
  _updateCameraFromTrackingMode()
139
139
  }
140
140
  }
141
- @objc var maxZoomLevel: NSNumber?
142
- @objc var minZoomLevel: NSNumber?
141
+ @objc var maxZoomLevel: NSNumber? {
142
+ didSet { _updateMaxBounds() }
143
+ }
144
+ @objc var minZoomLevel: NSNumber? {
145
+ didSet { _updateMaxBounds() }
146
+ }
143
147
  @objc var onUserTrackingModeChange: RCTBubblingEventBlock? = nil
144
148
  @objc var stop: [String: Any]? {
145
149
  didSet {
@@ -151,12 +155,15 @@ class RCTMGLCamera : RCTMGLMapComponentBase, LocationConsumer {
151
155
  didSet {
152
156
  if let maxBounds = maxBounds {
153
157
  logged("RCTMGLCamera.maxBounds") {
154
- let maxBoundsFeature = try JSONDecoder().decode(FeatureCollection.self, from: maxBounds.data(using: .utf8)!)
155
- try _updateMaxBounds(maxBoundsFeature)
158
+ maxBoundsFeature = try JSONDecoder().decode(FeatureCollection.self, from: maxBounds.data(using: .utf8)!)
156
159
  }
160
+ } else {
161
+ maxBoundsFeature = nil
157
162
  }
163
+ _updateMaxBounds()
158
164
  }
159
165
  }
166
+ var maxBoundsFeature : FeatureCollection? = nil
160
167
 
161
168
  // MARK: Update methods
162
169
 
@@ -213,10 +220,24 @@ class RCTMGLCamera : RCTMGLMapComponentBase, LocationConsumer {
213
220
  return CoordinateBounds(southwest: sw.coordinates, northeast: ne.coordinates)
214
221
  }
215
222
 
216
- func _updateMaxBounds(_ bounds: FeatureCollection) throws {
223
+ func _updateMaxBounds() {
217
224
  withMapView { map in
225
+ var options = CameraBoundsOptions()
226
+
227
+ if let maxBounds = self.maxBoundsFeature {
228
+ logged("RCTMGLCamera._updateMaxBounds._toCoordinateBounds") {
229
+ options.bounds = try self._toCoordinateBounds(maxBounds)
230
+ }
231
+ }
232
+ if let minZoomLevel = self.minZoomLevel {
233
+ options.minZoom = minZoomLevel.CGFloat
234
+ }
235
+ if let maxZoomLevel = self.maxZoomLevel {
236
+ options.maxZoom = maxZoomLevel.CGFloat
237
+ }
238
+
218
239
  logged("RCTMGLCamera._updateMaxBounds") {
219
- try map.mapboxMap.setCameraBounds(with: CameraBoundsOptions(bounds: try self._toCoordinateBounds(bounds)))
240
+ try map.mapboxMap.setCameraBounds(with: options)
220
241
  }
221
242
  }
222
243
  }
@@ -188,15 +188,15 @@ open class RCTMGLMapView : MapView {
188
188
  let glPosition = MapboxGLPosition(rawValue: position)
189
189
  switch glPosition {
190
190
  case .topLeft:
191
- return .topLeft
191
+ return .topLeading
192
192
  case .bottomRight:
193
- return .bottomRight
193
+ return .bottomTrailing
194
194
  case .topRight:
195
- return .topRight
195
+ return .topTrailing
196
196
  case .bottomLeft:
197
- return .bottomLeft
197
+ return .bottomLeading
198
198
  case .none:
199
- return .topLeft
199
+ return .topLeading
200
200
  }
201
201
  }
202
202
 
@@ -231,7 +231,7 @@ open class RCTMGLMapView : MapView {
231
231
  }
232
232
 
233
233
  @objc func setReactRotateEnabled(_ value: Bool) {
234
- self.mapView.gestures.options.pinchRotateEnabled = value
234
+ self.mapView.gestures.options.rotateEnabled = value
235
235
  }
236
236
 
237
237
  @objc func setReactPitchEnabled(_ value: Bool) {
@@ -251,20 +251,20 @@ open class RCTMGLMapView : MapView {
251
251
  }
252
252
  }
253
253
 
254
- private func getOrnamentOptionsFromPosition(_ position: [String: Int]!) -> (position: OrnamentPosition, margins: CGPoint)? {
254
+ private func getOrnamentOptionsFromPosition(_ position: [String: Int]) -> (position: OrnamentPosition, margins: CGPoint)? {
255
255
  let left = position["left"]
256
256
  let right = position["right"]
257
257
  let top = position["top"]
258
258
  let bottom = position["bottom"]
259
259
 
260
260
  if let left = left, let top = top {
261
- return (OrnamentPosition.topLeft, CGPoint(x: left, y: top))
261
+ return (OrnamentPosition.topLeading, CGPoint(x: left, y: top))
262
262
  } else if let right = right, let top = top {
263
- return (OrnamentPosition.topRight, CGPoint(x: right, y: top))
263
+ return (OrnamentPosition.topTrailing, CGPoint(x: right, y: top))
264
264
  } else if let bottom = bottom, let right = right {
265
- return (OrnamentPosition.bottomRight, CGPoint(x: right, y: bottom))
265
+ return (OrnamentPosition.bottomTrailing, CGPoint(x: right, y: bottom))
266
266
  } else if let bottom = bottom, let left = left {
267
- return (OrnamentPosition.bottomLeft, CGPoint(x: left, y: bottom))
267
+ return (OrnamentPosition.bottomLeading, CGPoint(x: left, y: bottom))
268
268
  }
269
269
 
270
270
  return nil
@@ -520,7 +520,7 @@ extension RCTMGLMapView: GestureManagerDelegate {
520
520
  let options = RenderedQueryOptions(
521
521
  layerIds: source.getLayerIDs(), filter: nil
522
522
  )
523
- self.mapboxMap.queryRenderedFeatures(in: hitboxRect, options: options) {
523
+ self.mapboxMap.queryRenderedFeatures(with: hitboxRect, options: options) {
524
524
  result in
525
525
 
526
526
  var newHits = hits
@@ -772,12 +772,6 @@ class PointAnnotationManager : AnnotationInteractionDelegate {
772
772
  }
773
773
  }
774
774
  }
775
- /*
776
-
777
- let rctmglPointAnnotation = userInfo[RCTMGLPointAnnotation.key] as? WeakRef<RCTMGLPointAnnotation>,
778
- let rctmglPointAnnotation = rctmglPointAnnotation.object {
779
- rctmglPointAnnotation.didTap()
780
- }*/
781
775
  }
782
776
  }
783
777
 
@@ -874,12 +868,6 @@ class PointAnnotationManager : AnnotationInteractionDelegate {
874
868
  }
875
869
  }
876
870
  }
877
- /*
878
-
879
- let rctmglPointAnnotation = userInfo[RCTMGLPointAnnotation.key] as? WeakRef<RCTMGLPointAnnotation>,
880
- let rctmglPointAnnotation = rctmglPointAnnotation.object {
881
- rctmglPointAnnotation.didTap()
882
- }*/
883
871
  }
884
872
  }
885
873
 
@@ -896,8 +884,8 @@ class PointAnnotationManager : AnnotationInteractionDelegate {
896
884
  }
897
885
  switch sender.state {
898
886
  case .began:
899
- mapFeatureQueryable.queryRenderedFeatures(
900
- at: sender.location(in: sender.view),
887
+ mapFeatureQueryable.queryRenderedFeatures(
888
+ with: sender.location(in: sender.view),
901
889
  options: options) { [weak self] (result) in
902
890
 
903
891
  guard let self = self else { return }
@@ -190,7 +190,7 @@ extension RCTMGLMapViewManager {
190
190
  logged("queryRenderedFeaturesAtPoint.option", rejecter: rejecter) {
191
191
  let options = try RenderedQueryOptions(layerIds: layerIDs, filter: filter?.asExpression())
192
192
 
193
- mapboxMap.queryRenderedFeatures(at: point, options: options) { result in
193
+ mapboxMap.queryRenderedFeatures(with: point, options: options) { result in
194
194
  switch result {
195
195
  case .success(let features):
196
196
  resolver([
@@ -214,17 +214,15 @@ extension RCTMGLMapViewManager {
214
214
  withLayerIDs layerIDs: [String]?,
215
215
  resolver: @escaping RCTPromiseResolveBlock,
216
216
  rejecter: @escaping RCTPromiseRejectBlock) -> Void {
217
- withMapboxMap(reactTag, name:"queryRenderedFeaturesInRect", rejecter: rejecter) { mapboxMap in
218
- let left = CGFloat(bbox[0].floatValue)
219
- let bottom = CGFloat(bbox[1].floatValue)
220
- let right = CGFloat(bbox[2].floatValue)
221
- let top = CGFloat(bbox[3].floatValue)
222
- let rect = CGRect(x: [left,right].min()!, y: [bottom,top].min()!, width: fabs(right-left), height: fabs(top-bottom))
223
-
217
+ withMapView(reactTag, name:"queryRenderedFeaturesInRect", rejecter: rejecter) { mapView in
218
+ let left = bbox.isEmpty ? 0.0 : CGFloat(bbox[0].floatValue)
219
+ let bottom = bbox.isEmpty ? 0.0 : CGFloat(bbox[1].floatValue)
220
+ let right = bbox.isEmpty ? 0.0 : CGFloat(bbox[2].floatValue)
221
+ let top = bbox.isEmpty ? 0.0 : CGFloat(bbox[3].floatValue)
222
+ let rect = bbox.isEmpty ? CGRect(x: 0.0, y: 0.0, width: mapView.bounds.size.width, height: mapView.bounds.size.height) : CGRect(x: [left,right].min()!, y: [top,bottom].min()!, width: abs(right-left), height: abs(bottom-top))
224
223
  logged("queryRenderedFeaturesInRect.option", rejecter: rejecter) {
225
224
  let options = try RenderedQueryOptions(layerIds: layerIDs, filter: filter?.asExpression())
226
-
227
- mapboxMap.queryRenderedFeatures(in: rect, options: options) { result in
225
+ mapView.mapboxMap.queryRenderedFeatures(with: rect, options: options) { result in
228
226
  switch result {
229
227
  case .success(let features):
230
228
  resolver([
@@ -233,7 +231,7 @@ extension RCTMGLMapViewManager {
233
231
  }]
234
232
  ])
235
233
  case .failure(let error):
236
- rejecter("queryRenderedFeaturesAtPoint","failed to query features", error)
234
+ rejecter("queryRenderedFeaturesInRect","failed to query features", error)
237
235
  }
238
236
  }
239
237
  }
@@ -495,33 +495,38 @@ class MapView extends NativeBridgeComponent(
495
495
 
496
496
  /**
497
497
  * Returns an array of rendered map features that intersect with the given rectangle,
498
- * restricted to the given style layers and filtered by the given predicate.
498
+ * restricted to the given style layers and filtered by the given predicate. In v10,
499
+ * passing an empty array will query the entire visible bounds of the map.
499
500
  *
500
501
  * @example
501
502
  * this._map.queryRenderedFeaturesInRect([30, 40, 20, 10], ['==', 'type', 'Point'], ['id1', 'id2'])
502
503
  *
503
- * @param {Array<Number>} bbox - A rectangle expressed in the map view’s coordinate system.
504
+ * @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.
504
505
  * @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.
505
506
  * @param {Array=} layerIDs - A array of layer id's to filter the features by
506
507
  * @return {FeatureCollection}
507
508
  */
508
509
  async queryRenderedFeaturesInRect(bbox, filter = [], layerIDs = []) {
509
- if (!bbox || bbox.length !== 4) {
510
- throw new Error(
511
- 'Must pass in a valid bounding box[top, right, bottom, left]',
510
+ if (
511
+ bbox != null &&
512
+ (bbox.length === 4 || (MapboxGL.MapboxV10 && bbox.length === 0))
513
+ ) {
514
+ const res = await this._runNativeCommand(
515
+ 'queryRenderedFeaturesInRect',
516
+ this._nativeRef,
517
+ [bbox, getFilter(filter), layerIDs],
512
518
  );
513
- }
514
- const res = await this._runNativeCommand(
515
- 'queryRenderedFeaturesInRect',
516
- this._nativeRef,
517
- [bbox, getFilter(filter), layerIDs],
518
- );
519
519
 
520
- if (isAndroid()) {
521
- return JSON.parse(res.data);
522
- }
520
+ if (isAndroid()) {
521
+ return JSON.parse(res.data);
522
+ }
523
523
 
524
- return res.data;
524
+ return res.data;
525
+ } else {
526
+ throw new Error(
527
+ 'Must pass in a valid bounding box: [top, right, bottom, left]. An empty array [] is also acceptable in v10.',
528
+ );
529
+ }
525
530
  }
526
531
 
527
532
  /**
@@ -120,18 +120,15 @@ class MarkerView extends React.PureComponent<Props> {
120
120
  allowOverlap={this.props.allowOverlap}
121
121
  isSelected={this.props.isSelected}
122
122
  onTouchEnd={(e) => {
123
- console.log('e => ');
124
123
  e.stopPropagation();
125
124
  }}
126
125
  >
127
126
  <View
128
127
  style={{ flex: 0, alignSelf: 'flex-start' }}
129
128
  onStartShouldSetResponder={(_event) => {
130
- console.log('+> onStart');
131
129
  return true;
132
130
  }}
133
131
  onTouchEnd={(e) => {
134
- console.log('e => ');
135
132
  e.stopPropagation();
136
133
  }}
137
134
  >
@@ -87,7 +87,7 @@ export class SymbolLayer extends AbstractLayer<Props, NativeTypeProps> {
87
87
  }
88
88
 
89
89
  React.Children.forEach(this.props.children, (child) => {
90
- if (child?.type === View) {
90
+ if (child !== undefined && 'type' in child && child.type === View) {
91
91
  isSnapshot = true;
92
92
  }
93
93
  });
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.0-beta.47",
4
+ "version": "10.0.0-beta.48",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },