From 94fc4eb4c1f0ce88e472d367168b755ff63201d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Fri, 1 Dec 2023 20:00:47 +0100 Subject: [PATCH] refactor!: deprecate Camera#onUserTrackingModeChange, and RNMapboxMapsUseV11 (#3224) --- README.md | 3 + docs/Camera.md | 1 + docs/LocationPuck.md | 147 ++++++++++++++++++++++++++++++++++++++ docs/docs.json | 2 +- example/ios/Podfile | 2 - rnmapbox-maps.podspec | 13 +++- src/components/Camera.tsx | 8 ++- 7 files changed, 171 insertions(+), 5 deletions(-) create mode 100644 docs/LocationPuck.md diff --git a/README.md b/README.md index 9e9ebc274..159754f33 100644 --- a/README.md +++ b/README.md @@ -183,8 +183,10 @@ const styles = StyleSheet.create({ - [Callout](/docs/Callout.md) - [Camera](docs/Camera.md) - [UserLocation](docs/UserLocation.md) +- [LocaitonPuck](docs/LocationPuck.md) - [Images](docs/Images.md) - [Image](docs/Image.md) +- [Models](docs/Models.md) ### Sources @@ -204,6 +206,7 @@ const styles = StyleSheet.create({ - [SymbolLayer](/docs/SymbolLayer.md) - [HeatmapLayer](/docs/HeatmapLayer.md) - [SkyLayer](/docs/SkyLayer.md) +- [ModelLayer](/docs/ModelLayer.md) ### Terrain diff --git a/docs/Camera.md b/docs/Camera.md index e4ca15b07..073dee4dd 100644 --- a/docs/Camera.md +++ b/docs/Camera.md @@ -250,6 +250,7 @@ configuration. (Not yet implemented.) func ``` Executes when user tracking mode changes. +@deprecated use Viewport#onStatusChanged instead. *signature:*`(event:MapboxGLEvent) => void` diff --git a/docs/LocationPuck.md b/docs/LocationPuck.md new file mode 100644 index 000000000..573bb153d --- /dev/null +++ b/docs/LocationPuck.md @@ -0,0 +1,147 @@ + + + + +```tsx +import { LocationPuck } from '@rnmapbox/maps'; + +LocationPuck + +``` +Renders a puck on the map that shows the device's current location. + +## props + + +### androidRenderMode + +```tsx +'normal' | 'compass' | 'gps' +``` +Android render mode. + + - normal: just a circle + - compass: triangle with heading + - gps: large arrow + +@deprecated use `puckBearing` for source and `bearingImage` for image +@platform android + + + +### puckBearing + +```tsx +'heading' | 'course' +``` +The bearing of the puck. + + - heading: Orients the puck to match the direction in which the device is facing. + - course: Orients the puck to match the direction in which the device is moving. + + + +### puckBearingEnabled + +```tsx +boolean +``` +Whether the puck rotates to track the bearing source. + + + +### iosShowsUserHeadingIndicator + +```tsx +boolean +``` +iOS only. A Boolean value indicating whether the user location annotation may display a permanent heading indicator. + +@platform ios +@deprecated use `puckBearingEnabled={true} puckBrearing="heading"` instead + + + +### topImage + +```tsx +string +``` +The name of image to use as the top layer for the location indicator. Images component should define this image. + +[Custom Native UserLocation](../examples/UserLocation/CustomNativeUserLocation) + +### bearingImage + +```tsx +string +``` +The name of image to use as the middle layer for the location indicator. Images component should define this image. + + + +### shadowImage + +```tsx +string +``` +The name of image to use as the background for the location indicator. Images component should define this image. + + + +### scale + +```tsx +T | Expression +``` +The size of the images, as a scale factor applied to the size of the specified image. Supports expressions based on zoom. + +@example +["interpolate",["linear"], ["zoom"], 10.0, 1.0, 20.0, 4.0]] +@example +2.0 + +[Custom Native UserLocation](../examples/UserLocation/CustomNativeUserLocation) + +### pulsing + +```tsx +| { + /** + * Flag determining whether the pulsing circle animation. + */ + isEnabled?: boolean; + + /** + * The color of the pulsing circle. + */ + color?: number | ColorValue; + + /** + * Circle radius configuration for the pulsing circle animation. + * - accuracy: Pulsing circle animates with the `horizontalAccuracy` form the latest puck location. + * - number: Pulsing circle should animate with the constant radius. + */ + radius?: 'accuracy' | number; + } +| 'default' +``` +The configration parameters for sonar-like pulsing circle animation shown around the 2D puck. + + + +### visible + +```tsx +boolean +``` +Whether location icon is visible, defaults to true + + + + + + + + + diff --git a/docs/docs.json b/docs/docs.json index dd90393af..5d33d5871 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -900,7 +900,7 @@ "funcSignature": "(event:MapboxGLEvent) => void" }, "default": "none", - "description": "Executes when user tracking mode changes.\n*signature:*`(event:MapboxGLEvent) => void`" + "description": "Executes when user tracking mode changes.\n@deprecated use Viewport#onStatusChanged instead.\n*signature:*`(event:MapboxGLEvent) => void`" } ], "fileNameWithExt": "Camera.tsx", diff --git a/example/ios/Podfile b/example/ios/Podfile index 5bf78964d..9f8975648 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -10,7 +10,6 @@ prepare_react_native_project! $RNMapboxMapsImpl = 'mapbox' if ENV['RNMBX11'] - $RNMapboxMapsUseV11 = true # use 11 version $RNMapboxMapsVersion = '= 11.0.0' end @@ -21,7 +20,6 @@ if ENV['CI_MAP_IMPL'] $RNMapboxMapsImpl = 'mapbox' when 'mapbox11' $RNMapboxMapsImpl = 'mapbox' - $RNMapboxMapsUseV11 = true # use 11 version $RNMapboxMapsVersion = '= 11.0.0' else fail "Invalid CI_MAP_IMPL value: #{ENV['CI_MAP_IMPL']}" diff --git a/rnmapbox-maps.podspec b/rnmapbox-maps.podspec index 76e0729f8..167994d96 100644 --- a/rnmapbox-maps.podspec +++ b/rnmapbox-maps.podspec @@ -74,6 +74,15 @@ else fail "$RNMapboxMapsImpl should be one of mapbox" end +if $RNMapboxMapsUseV11 != nil + warn "WARNING: $RNMapboxMapsUseV11 is deprecated just set $RNMapboxMapsVersion to '= 11.0.0" +end + +if $MapboxImplVersion =~ /(~>|>=|=|>)?\S*11\./ + $RNMapboxMapsUseV11 = true +end + + $RNMapboxMaps = Object.new def $RNMapboxMaps._check_no_mapbox_spm(project) @@ -125,7 +134,9 @@ rescue end def $RNMapboxMaps.post_install(installer) - if $RNMapboxMapsUseV11 + map_pod = installer.pod_targets.find {|p| p.name == "MapboxMaps" } + use_v11 = $RNMapboxMapsUseV11 || (map_pod && map_pod.version.split('.')[0].to_i >= 11) + if use_v11 installer.pods_project.build_configurations.each do |config| config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['$(inherited)', '-D RNMBX_11'] end diff --git a/src/components/Camera.tsx b/src/components/Camera.tsx index 28342ca19..0d3aa2594 100644 --- a/src/components/Camera.tsx +++ b/src/components/Camera.tsx @@ -154,13 +154,19 @@ export interface CameraProps CameraMinMaxConfig { /** The configuration that the camera falls back on, if no other values are specified. */ defaultSettings?: CameraStop; + /** Whether the camera should send any configuration to the native module. Prevents unnecessary tile * fetching and improves performance when the map is not visible. Defaults to `true`. */ allowUpdates?: boolean; + /** Any arbitrary primitive value that, when changed, causes the camera to retry moving to its target * configuration. (Not yet implemented.) */ triggerKey?: string | number; - /** Executes when user tracking mode changes. */ + + /** + * Executes when user tracking mode changes. + * @deprecated use Viewport#onStatusChanged instead. + */ onUserTrackingModeChange?: UserTrackingModeChangeCallback; }