@rnmapbox/maps 10.3.0-rc.0 → 10.3.0

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 (46) hide show
  1. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewContent.kt +55 -0
  2. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewContentManager.kt +7 -2
  3. package/android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewManager.kt +0 -2
  4. package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXNativeUserLocationManager.kt +25 -24
  5. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/NativeMapViewModule.kt +3 -2
  6. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt +57 -39
  7. package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapViewManager.kt +0 -9
  8. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/atmosphere/RNMBXAtmosphere.kt +4 -4
  9. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/atmosphere/RNMBXAtmosphereManager.kt +2 -1
  10. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/light/RNMBXLightManager.kt +2 -1
  11. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXSource.kt +2 -6
  12. package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/terrain/RNMBXTerrainManager.kt +2 -1
  13. package/android/src/main/java/com/rnmapbox/rnmbx/events/FeatureClickEvent.java +5 -6
  14. package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXModule.kt +1 -0
  15. package/android/src/main/java/com/rnmapbox/rnmbx/utils/ConvertUtils.kt +0 -30
  16. package/android/src/main/java/com/rnmapbox/rnmbx/utils/extensions/Dynamic.kt +3 -1
  17. package/android/src/main/java/com/rnmapbox/rnmbx/utils/extensions/ReadableArray.kt +16 -14
  18. package/ios/RNMBX/RNMBXMapViewModule.mm +1 -1
  19. package/ios/RNMBX/RNMBXModule.swift +1 -0
  20. package/lib/module/Mapbox.native.js.map +1 -1
  21. package/lib/module/components/MapView.js +95 -113
  22. package/lib/module/components/MapView.js.map +1 -1
  23. package/lib/module/components/MarkerView.js +93 -76
  24. package/lib/module/components/MarkerView.js.map +1 -1
  25. package/lib/module/modules/offline/offlineManager.js +2 -12
  26. package/lib/module/modules/offline/offlineManager.js.map +1 -1
  27. package/lib/module/specs/RNMBXMarkerViewContentNativeComponent.ts +13 -1
  28. package/lib/typescript/src/Mapbox.native.d.ts +1 -1
  29. package/lib/typescript/src/Mapbox.native.d.ts.map +1 -1
  30. package/lib/typescript/src/components/Camera.d.ts +2 -2
  31. package/lib/typescript/src/components/Camera.d.ts.map +1 -1
  32. package/lib/typescript/src/components/MapView.d.ts +53 -41
  33. package/lib/typescript/src/components/MapView.d.ts.map +1 -1
  34. package/lib/typescript/src/components/MarkerView.d.ts +10 -17
  35. package/lib/typescript/src/components/MarkerView.d.ts.map +1 -1
  36. package/lib/typescript/src/modules/offline/offlineManager.d.ts.map +1 -1
  37. package/lib/typescript/src/specs/RNMBXMarkerViewContentNativeComponent.d.ts +6 -0
  38. package/lib/typescript/src/specs/RNMBXMarkerViewContentNativeComponent.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/setup-jest.js +1 -1
  41. package/src/Mapbox.native.ts +5 -1
  42. package/src/components/Camera.tsx +2 -2
  43. package/src/components/MapView.tsx +137 -154
  44. package/src/components/MarkerView.tsx +118 -95
  45. package/src/modules/offline/offlineManager.ts +2 -14
  46. package/src/specs/RNMBXMarkerViewContentNativeComponent.ts +13 -1
@@ -37,11 +37,6 @@ if (RNMBXModule == null) {
37
37
  'Native part of Mapbox React Native libraries were not registered properly, double check our native installation guides.',
38
38
  );
39
39
  }
40
- if (!RNMBXModule.MapboxV10) {
41
- console.warn(
42
- '@rnmapbox/maps: Non v10 implementations are deprecated and will be removed in next version - see https://github.com/rnmapbox/maps/wiki/Deprecated-RNMapboxImpl-Maplibre',
43
- );
44
- }
45
40
 
46
41
  const styles = StyleSheet.create({
47
42
  matchParent: { flex: 1 },
@@ -65,6 +60,11 @@ export type RegionPayload = {
65
60
  pitch: number;
66
61
  };
67
62
 
63
+ export type ScreenPointPayload = {
64
+ readonly screenPointX: number;
65
+ readonly screenPointY: number;
66
+ };
67
+
68
68
  export type GestureSettings = {
69
69
  /**
70
70
  * Whether double tapping the map with one touch results in a zoom-in animation.
@@ -312,14 +312,18 @@ type Props = ViewProps & {
312
312
  gestureSettings?: GestureSettings;
313
313
 
314
314
  /**
315
- * Map press listener, gets called when a user presses the map
315
+ * Map press listener, called when a user presses the map.
316
316
  */
317
- onPress?: (feature: GeoJSON.Feature) => void;
317
+ onPress?: (
318
+ feature: GeoJSON.Feature<GeoJSON.Point, ScreenPointPayload>,
319
+ ) => void;
318
320
 
319
321
  /**
320
- * Map long press listener, gets called when a user long presses the map
322
+ * Map long press listener, called when a user long presses the map.
321
323
  */
322
- onLongPress?: (feature: GeoJSON.Feature) => void;
324
+ onLongPress?: (
325
+ feature: GeoJSON.Feature<GeoJSON.Point, ScreenPointPayload>,
326
+ ) => void;
323
327
 
324
328
  /**
325
329
  * <v10 only
@@ -470,7 +474,7 @@ const CallbablePropKeys = [
470
474
  'onCameraChanged',
471
475
  ] as const;
472
476
 
473
- type CallbablePropKeys = (typeof CallbablePropKeys)[number];
477
+ type CallbablePropKeys = typeof CallbablePropKeys[number];
474
478
 
475
479
  type CallbablePropKeysWithoutOn = CallbablePropKeys extends `on${infer C}`
476
480
  ? C
@@ -494,7 +498,7 @@ class MapView extends NativeBridgeComponent(
494
498
  compassFadeWhenNorth: false,
495
499
  logoEnabled: true,
496
500
  scaleBarEnabled: true,
497
- surfaceView: RNMBXModule.MapboxV10 ? true : false,
501
+ surfaceView: true,
498
502
  requestDisallowInterceptTouchEvent: false,
499
503
  regionWillChangeDebounceTime: 10,
500
504
  regionDidChangeDebounceTime: 500,
@@ -591,93 +595,93 @@ class MapView extends NativeBridgeComponent(
591
595
  }
592
596
 
593
597
  _setHandledMapChangedEvents(props: Props) {
594
- if (isAndroid() || RNMBXModule.MapboxV10) {
595
- const events: string[] = [];
596
-
597
- function addIfHasHandler(name: CallbablePropKeysWithoutOn) {
598
- if (props[`on${name}`] != null) {
599
- if (EventTypes[name] == null) {
600
- if (name === 'DidFailLoadingMap') {
601
- console.warn(
602
- `rnmapbox maps: on${name} is deprecated, please use onMapLoadingError`,
603
- );
604
- } else {
605
- console.warn(`rnmapbox maps: ${name} is not supported`);
606
- }
598
+ const events: string[] = [];
599
+
600
+ function addIfHasHandler(name: CallbablePropKeysWithoutOn) {
601
+ if (props[`on${name}`] != null) {
602
+ if (EventTypes[name] == null) {
603
+ if (name === 'DidFailLoadingMap') {
604
+ console.warn(
605
+ `rnmapbox maps: on${name} is deprecated, please use onMapLoadingError`,
606
+ );
607
607
  } else {
608
- events.push(EventTypes[name]);
609
- return true;
608
+ console.warn(`rnmapbox maps: ${name} is not supported`);
610
609
  }
610
+ } else {
611
+ events.push(EventTypes[name]);
612
+ return true;
611
613
  }
612
- return false;
613
614
  }
615
+ return false;
616
+ }
614
617
 
615
- addIfHasHandler('RegionWillChange');
616
- addIfHasHandler('RegionIsChanging');
617
- addIfHasHandler('RegionDidChange');
618
- addIfHasHandler('UserLocationUpdate');
619
- addIfHasHandler('WillStartLoadingMap');
620
- addIfHasHandler('DidFinishLoadingMap');
621
- addIfHasHandler('MapLoadingError');
622
- addIfHasHandler('DidFailLoadingMap');
623
- addIfHasHandler('WillStartRenderingFrame');
624
- addIfHasHandler('DidFinishRenderingFrame');
625
- addIfHasHandler('DidFinishRenderingFrameFully');
626
- addIfHasHandler('WillStartRenderingMap');
627
- addIfHasHandler('DidFinishRenderingMap');
628
- addIfHasHandler('DidFinishRenderingMapFully');
629
- addIfHasHandler('DidFinishLoadingStyle');
630
-
631
- addIfHasHandler('CameraChanged');
632
- addIfHasHandler('MapIdle');
633
-
634
- if (addIfHasHandler('RegionDidChange')) {
635
- if (!this.deprecationLogged.regionDidChange) {
636
- console.warn(
637
- 'onRegionDidChange is deprecated and will be removed in next release - please use onMapIdle. https://github.com/rnmapbox/maps/wiki/Deprecated-RegionIsDidChange',
638
- );
639
- this.deprecationLogged.regionDidChange = true;
640
- }
641
- if (props.onMapIdle) {
642
- console.warn(
643
- 'rnmapbox/maps: only one of MapView.onRegionDidChange or onMapIdle is supported',
644
- );
645
- }
618
+ addIfHasHandler('RegionWillChange');
619
+ addIfHasHandler('RegionIsChanging');
620
+ addIfHasHandler('RegionDidChange');
621
+ addIfHasHandler('UserLocationUpdate');
622
+ addIfHasHandler('WillStartLoadingMap');
623
+ addIfHasHandler('DidFinishLoadingMap');
624
+ addIfHasHandler('MapLoadingError');
625
+ addIfHasHandler('DidFailLoadingMap');
626
+ addIfHasHandler('WillStartRenderingFrame');
627
+ addIfHasHandler('DidFinishRenderingFrame');
628
+ addIfHasHandler('DidFinishRenderingFrameFully');
629
+ addIfHasHandler('WillStartRenderingMap');
630
+ addIfHasHandler('DidFinishRenderingMap');
631
+ addIfHasHandler('DidFinishRenderingMapFully');
632
+ addIfHasHandler('DidFinishLoadingStyle');
633
+
634
+ addIfHasHandler('CameraChanged');
635
+ addIfHasHandler('MapIdle');
636
+
637
+ if (addIfHasHandler('RegionDidChange')) {
638
+ if (!this.deprecationLogged.regionDidChange) {
639
+ console.warn(
640
+ 'onRegionDidChange is deprecated and will be removed in next release - please use onMapIdle. https://github.com/rnmapbox/maps/wiki/Deprecated-RegionIsDidChange',
641
+ );
642
+ this.deprecationLogged.regionDidChange = true;
646
643
  }
647
- if (addIfHasHandler('RegionIsChanging')) {
648
- if (!this.deprecationLogged.regionIsChanging) {
649
- console.warn(
650
- 'onRegionIsChanging is deprecated and will be removed in next release - please use onCameraChanged. https://github.com/rnmapbox/maps/wiki/Deprecated-RegionIsDidChange',
651
- );
652
- this.deprecationLogged.regionIsChanging = true;
653
- }
654
- if (props.onCameraChanged) {
655
- console.warn(
656
- 'rnmapbox/maps: only one of MapView.onRegionIsChanging or onCameraChanged is supported',
657
- );
658
- }
644
+ if (props.onMapIdle) {
645
+ console.warn(
646
+ 'rnmapbox/maps: only one of MapView.onRegionDidChange or onMapIdle is supported',
647
+ );
659
648
  }
660
-
661
- if (props.onRegionWillChange) {
649
+ }
650
+ if (addIfHasHandler('RegionIsChanging')) {
651
+ if (!this.deprecationLogged.regionIsChanging) {
652
+ console.warn(
653
+ 'onRegionIsChanging is deprecated and will be removed in next release - please use onCameraChanged. https://github.com/rnmapbox/maps/wiki/Deprecated-RegionIsDidChange',
654
+ );
655
+ this.deprecationLogged.regionIsChanging = true;
656
+ }
657
+ if (props.onCameraChanged) {
662
658
  console.warn(
663
- 'onRegionWillChange is deprecated and will be removed in v10 - please use onRegionIsChanging',
659
+ 'rnmapbox/maps: only one of MapView.onRegionIsChanging or onCameraChanged is supported',
664
660
  );
665
661
  }
662
+ }
666
663
 
667
- this._runNativeMethod('setHandledMapChangedEvents', this._nativeRef, [
668
- events,
669
- ]);
664
+ if (props.onRegionWillChange) {
665
+ console.warn(
666
+ 'onRegionWillChange is deprecated and will be removed in v10 - please use onRegionIsChanging',
667
+ );
670
668
  }
669
+
670
+ this._runNativeMethod('setHandledMapChangedEvents', this._nativeRef, [
671
+ events,
672
+ ]);
671
673
  }
672
674
 
673
675
  /**
674
- * Converts a geographic coordinate to a point in the given view’s coordinate system.
676
+ * Converts a geographic coordinate to a screen coordinate relative to the map view.
675
677
  *
676
678
  * @example
677
- * const pointInView = await this._map.getPointInView([-37.817070, 144.949901]);
679
+ * const longitude = 144.949901;
680
+ * const latitude = -37.817070;
681
+ * const [x, y] = await this._map.getPointInView([longitude, latitude]);
678
682
  *
679
- * @param {Array<number>} coordinate - A point expressed in the map view's coordinate system.
680
- * @return {Array}
683
+ * @param {Position} coordinate - A point expressed in the map view's coordinate system `[longitude, latitude]`.
684
+ * @return {Position} A point expressed in screen coordinates relative to the map view `[x, y]`.
681
685
  */
682
686
  async getPointInView(coordinate: Position): Promise<Position> {
683
687
  const res = await this._runNative<{ pointInView: Position }>(
@@ -688,13 +692,14 @@ class MapView extends NativeBridgeComponent(
688
692
  }
689
693
 
690
694
  /**
691
- * Converts a point in the given view’s coordinate system to a geographic coordinate.
695
+ * Converts a screen coordinate relative to the map view to a geographic coordinate.
692
696
  *
693
697
  * @example
694
- * const coordinate = await this._map.getCoordinateFromView([100, 100]);
698
+ * const x = 100; const y = 100;
699
+ * const [longitude, latitude] = await this._map.getCoordinateFromView([x, y]);
695
700
  *
696
- * @param {Array<number>} point - A point expressed in the given view’s coordinate system.
697
- * @return {Array}
701
+ * @param {Position} point - A point expressed in screen coordinates relative to the map view `[x, y]`.
702
+ * @return {Position} A point expressed in the map view's coordinate system `[longitude, latitude]`.
698
703
  */
699
704
  async getCoordinateFromView(point: Position): Promise<Position> {
700
705
  const res = await this._runNative<{ coordinateFromView: Position }>(
@@ -705,12 +710,12 @@ class MapView extends NativeBridgeComponent(
705
710
  }
706
711
 
707
712
  /**
708
- * The coordinate bounds (ne, sw) visible in the user’s viewport.
713
+ * The coordinate bounds of the map viewport.
709
714
  *
710
715
  * @example
711
- * const visibleBounds = await this._map.getVisibleBounds();
716
+ * const [[rightLon, topLat], [leftLon, bottomLat]] = await this._map.getVisibleBounds();
712
717
  *
713
- * @return {Array}
718
+ * @return {[Position, Position]} The geographic coordinate bounds of the map viewport `[[rightLon, topLat], [leftLon, bottomLat]]`.
714
719
  */
715
720
  async getVisibleBounds(): Promise<[Position, Position]> {
716
721
  const res = await this._runNative<{ visibleBounds: [Position, Position] }>(
@@ -723,12 +728,13 @@ class MapView extends NativeBridgeComponent(
723
728
  * Returns an array of rendered map features that intersect with a given point.
724
729
  *
725
730
  * @example
726
- * this._map.queryRenderedFeaturesAtPoint([30, 40], ['==', 'type', 'Point'], ['id1', 'id2'])
731
+ * const x = 30; const y = 40;
732
+ * this._map.queryRenderedFeaturesAtPoint([x, y], ['==', 'type', 'Point'], ['id1', 'id2'])
727
733
  *
728
- * @param {Array<Number>} coordinate - A point expressed in the map view’s coordinate system.
729
- * @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.
730
- * @param {Array=} layerIDs - A array of layer id's to filter the features by
731
- * @return {FeatureCollection}
734
+ * @param {Position} coordinate - A point expressed in the map view’s coordinate system `[x, y]`;
735
+ * @param {FilterExpression | []} 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.
736
+ * @param {string[]} layerIDs - A array of layer IDs by which to filter the features.
737
+ * @return {FeatureCollection} A GeoJSON feature collection containing the query results.
732
738
  */
733
739
 
734
740
  async queryRenderedFeaturesAtPoint(
@@ -758,22 +764,21 @@ class MapView extends NativeBridgeComponent(
758
764
  * passing an empty array will query the entire visible bounds of the map.
759
765
  *
760
766
  * @example
761
- * this._map.queryRenderedFeaturesInRect([30, 40, 20, 10], ['==', 'type', 'Point'], ['id1', 'id2'])
767
+ * const left = 40; const top = 30;
768
+ * const right = 10; const bottom = 20;
769
+ * this._map.queryRenderedFeaturesInRect([top, left, bottom, right], ['==', 'type', 'Point'], ['id1', 'id2'])
762
770
  *
763
- * @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.
764
- * @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.
765
- * @param {Array=} layerIDs - A array of layer id's to filter the features by
766
- * @return {FeatureCollection}
771
+ * @param {BBox | []} bbox - A rectangle expressed in density-independent screen coordinates relative to the map view `[top, left, bottom, right]` or `[minY, minX, maxY, maxX]` (not geographic coordinates). An empty array queries the visible map area.
772
+ * @param {FilterExpression} filter - An array 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.
773
+ * @param {string[] | null} layerIDs - A array of layer IDs by which to filter the features.
774
+ * @return {FeatureCollection} A GeoJSON feature collection containing the query results.
767
775
  */
768
776
  async queryRenderedFeaturesInRect(
769
777
  bbox: BBox | [],
770
778
  filter: FilterExpression | [] = [],
771
779
  layerIDs: string[] | null = null,
772
780
  ): Promise<GeoJSON.FeatureCollection | undefined> {
773
- if (
774
- bbox != null &&
775
- (bbox.length === 4 || (RNMBXModule.MapboxV10 && bbox.length === 0))
776
- ) {
781
+ if (bbox != null && (bbox.length === 4 || bbox.length === 0)) {
777
782
  const res = await this._runNative<{ data: GeoJSON.FeatureCollection }>(
778
783
  'queryRenderedFeaturesInRect',
779
784
  [bbox, getFilter(filter), layerIDs],
@@ -786,7 +791,7 @@ class MapView extends NativeBridgeComponent(
786
791
  return res.data;
787
792
  } else {
788
793
  throw new Error(
789
- 'Must pass in a valid bounding box: [top, right, bottom, left]. An empty array [] is also acceptable in v10.',
794
+ 'Must pass in a valid bounding box: [top, left, bottom, right]. An empty array [] is also acceptable in v10.',
790
795
  );
791
796
  }
792
797
  }
@@ -798,9 +803,9 @@ class MapView extends NativeBridgeComponent(
798
803
  * this._map.querySourceFeatures('your-source-id', [], ['your-source-layer'])
799
804
  *
800
805
  * @param {String} sourceId - Style source identifier used to query for source features.
801
- * @param {Array=} filter - A filter to limit query results.
802
- * @param {Array=} sourceLayerIDs - The name of the source layers to query. For vector tile sources, this parameter is required. For GeoJSON sources, it is ignored.
803
- * @return {FeatureCollection}
806
+ * @param {FilterExpression | []} filter - A filter to limit query results.
807
+ * @param {string[]} sourceLayerIDs - The name of the source layers to query. For vector tile sources, this parameter is required. For GeoJSON sources, it is ignored.
808
+ * @return {FeatureCollection} A GeoJSON feature collection.
804
809
  */
805
810
  async querySourceFeatures(
806
811
  sourceId: string,
@@ -844,9 +849,11 @@ class MapView extends NativeBridgeComponent(
844
849
  }
845
850
 
846
851
  /**
847
- * Takes snapshot of map with current tiles and returns a URI to the image
848
- * @param {Boolean} writeToDisk If true will create a temp file, otherwise it is in base64
849
- * @return {String}
852
+ * Takes snapshot of map with current tiles and returns a Base64-encoded PNG image,
853
+ * or an file-system URI to a temporary PNG file if `writeToDisk` is `true`.
854
+ *
855
+ * @param {boolean} writeToDisk If `true`, creates a temporary PNG file and returns a file-system URI, otherwise returns a Base64-encoded PNG image. (Defaults to `false`)
856
+ * @return {string} A a Base64-encoded PNG image or a file-system URI to a temporary PNG file.
850
857
  */
851
858
  async takeSnap(writeToDisk = false): Promise<string> {
852
859
  const res = await this._runNative<{ uri: string }>('takeSnap', [
@@ -861,7 +868,7 @@ class MapView extends NativeBridgeComponent(
861
868
  * @example
862
869
  * const zoom = await this._map.getZoom();
863
870
  *
864
- * @return {Number}
871
+ * @return {number} The current zoom of the map view.
865
872
  */
866
873
 
867
874
  async getZoom(): Promise<number> {
@@ -870,12 +877,12 @@ class MapView extends NativeBridgeComponent(
870
877
  }
871
878
 
872
879
  /**
873
- * Returns the map's geographical centerpoint
880
+ * Returns the map's center point expressed as geographic coordinates `[longitude, latitude]`.
874
881
  *
875
882
  * @example
876
883
  * const center = await this._map.getCenter();
877
884
  *
878
- * @return {Array<Number>} Coordinates
885
+ * @return {Position} The map's center point expressed as geographic coordinates `[longitude, latitude]`.
879
886
  */
880
887
  async getCenter(): Promise<Position> {
881
888
  const res = await this._runNative<{ center: Position }>('getCenter');
@@ -891,12 +898,6 @@ class MapView extends NativeBridgeComponent(
891
898
  * v10 only
892
899
  */
893
900
  async clearData(): Promise<void> {
894
- if (!RNMBXModule.MapboxV10) {
895
- console.warn(
896
- 'RNMapbox: clearData is only implemented in v10 implementation or later',
897
- );
898
- return;
899
- }
900
901
  await this._runNative<void>('clearData');
901
902
  }
902
903
 
@@ -905,8 +906,8 @@ class MapView extends NativeBridgeComponent(
905
906
  * The elevation is returned in meters relative to mean sea-level.
906
907
  * Returns null if terrain is disabled or if terrain data for the location hasn't been loaded yet.
907
908
  *
908
- * @param {Array<Number>} coordinate - the coordinates to query elevation at
909
- * @return {Number}
909
+ * @param {Position} coordinate - The geographic coordinates `[longitude, latitude]` at which to query elevation.
910
+ * @return {number} Elevation in meters relative to mean sea-level.
910
911
  */
911
912
  async queryTerrainElevation(coordinate: Position): Promise<number> {
912
913
  const res = await this._runNative<{ data: number }>(
@@ -923,8 +924,8 @@ class MapView extends NativeBridgeComponent(
923
924
  * await this._map.setSourceVisibility(false, 'composite', 'building')
924
925
  *
925
926
  * @param {boolean} visible - Visibility of the layers
926
- * @param {String} sourceId - Identifier of the target source (e.g. 'composite')
927
- * @param {String=} sourceLayerId - Identifier of the target source-layer (e.g. 'building')
927
+ * @param {string} sourceId - Target source identifier (e.g. 'composite')
928
+ * @param {string | null} sourceLayerId - Target source-layer identifier (e.g. 'building'). If `null`, the change affects all layers in the target source.
928
929
  */
929
930
  setSourceVisibility(
930
931
  visible: boolean,
@@ -956,13 +957,6 @@ class MapView extends NativeBridgeComponent(
956
957
  sourceId: string,
957
958
  sourceLayerId: string | null = null,
958
959
  ): Promise<void> {
959
- if (!RNMBXModule.MapboxV10) {
960
- console.warn(
961
- 'RNMapbox: setFeatureState is only implemented in v10 implementation or later',
962
- );
963
- return;
964
- }
965
-
966
960
  await this._runNative<void>('setFeatureState', [
967
961
  featureId,
968
962
  state,
@@ -983,13 +977,6 @@ class MapView extends NativeBridgeComponent(
983
977
  sourceId: string,
984
978
  sourceLayerId: string | null = null,
985
979
  ): Promise<Readonly<Record<string, unknown>>> {
986
- if (!RNMBXModule.MapboxV10) {
987
- console.warn(
988
- 'RNMapbox: setFeatureState is only implemented in v10 implementation or later',
989
- );
990
- return {};
991
- }
992
-
993
980
  const res = await this._runNative<{
994
981
  featureState: Readonly<Record<string, unknown>>;
995
982
  }>('getFeatureState', [featureId, sourceId, sourceLayerId]);
@@ -1013,13 +1000,6 @@ class MapView extends NativeBridgeComponent(
1013
1000
  sourceId: string,
1014
1001
  sourceLayerId: string | null = null,
1015
1002
  ): Promise<void> {
1016
- if (!RNMBXModule.MapboxV10) {
1017
- console.warn(
1018
- 'RNMapbox: removeFeatureState is only implemented in v10 implementation or later',
1019
- );
1020
- return;
1021
- }
1022
-
1023
1003
  await this._runNative<void>('removeFeatureState', [
1024
1004
  featureId,
1025
1005
  stateKey,
@@ -1036,13 +1016,21 @@ class MapView extends NativeBridgeComponent(
1036
1016
  }
1037
1017
  }
1038
1018
 
1039
- _onPress(e: NativeSyntheticEvent<{ payload: GeoJSON.Feature | string }>) {
1019
+ _onPress(
1020
+ e: NativeSyntheticEvent<{
1021
+ payload: GeoJSON.Feature<GeoJSON.Point, ScreenPointPayload> | string;
1022
+ }>,
1023
+ ) {
1040
1024
  if (isFunction(this.props.onPress)) {
1041
1025
  this.props.onPress(this._decodePayload(e.nativeEvent.payload));
1042
1026
  }
1043
1027
  }
1044
1028
 
1045
- _onLongPress(e: NativeSyntheticEvent<{ payload: GeoJSON.Feature | string }>) {
1029
+ _onLongPress(
1030
+ e: NativeSyntheticEvent<{
1031
+ payload: GeoJSON.Feature<GeoJSON.Point, ScreenPointPayload> | string;
1032
+ }>,
1033
+ ) {
1046
1034
  if (isFunction(this.props.onLongPress)) {
1047
1035
  this.props.onLongPress(this._decodePayload(e.nativeEvent.payload));
1048
1036
  }
@@ -1187,13 +1175,11 @@ class MapView extends NativeBridgeComponent(
1187
1175
  return;
1188
1176
  }
1189
1177
 
1190
- if (RNMBXModule.MapboxV10) {
1191
- if (!this.deprecationLogged.contentInset) {
1192
- console.warn(
1193
- '@rnmapbox/maps: contentInset is deprecated, use Camera padding instead.',
1194
- );
1195
- this.deprecationLogged.contentInset = true;
1196
- }
1178
+ if (!this.deprecationLogged.contentInset) {
1179
+ console.warn(
1180
+ '@rnmapbox/maps: contentInset is deprecated, use Camera padding instead.',
1181
+ );
1182
+ this.deprecationLogged.contentInset = true;
1197
1183
  }
1198
1184
 
1199
1185
  if (!Array.isArray(this.props.contentInset)) {
@@ -1235,9 +1221,6 @@ class MapView extends NativeBridgeComponent(
1235
1221
  }
1236
1222
 
1237
1223
  _setLocalizeLabels(props: Props) {
1238
- if (!RNMBXModule.MapboxV10) {
1239
- return;
1240
- }
1241
1224
  if (typeof props.localizeLabels === 'boolean') {
1242
1225
  props.localizeLabels = {
1243
1226
  locale: 'current',