LocationPuck component renders a native puck on the map that shows the device’s current location. This is the modern, recommended approach for displaying user location.
Basic Usage
Props
Deprecated: Use
puckBearing for bearing source and bearingImage for custom images.Android render mode:normal: Simple circlecompass: Triangle with headinggps: Large arrow
Determines the bearing source for puck orientation:
heading: Orients the puck to match the direction the device is facing (compass direction)course: Orients the puck to match the direction the device is moving (movement direction)
Whether the puck rotates to track the bearing source specified in
puckBearing.Deprecated: Use
puckBearingEnabled={true} puckBearing="heading" instead.iOS only. A Boolean value indicating whether the user location annotation displays a permanent heading indicator.Platform: iOS onlyThe name of the image to use as the top layer for the location indicator. The image must be defined in an
Images component.The name of the image to use as the middle layer for the location indicator. The image must be defined in an
Images component.Used to display directional information (heading/course).The name of the image to use as the background for the location indicator. The image must be defined in an
Images component.The size of the images, as a scale factor applied to the size of the specified image. Supports Mapbox expressions based on zoom level.
Configuration for the sonar-like pulsing circle animation shown around the 2D puck.Use
'default' for default pulsing animation, or provide a configuration object:Whether the location icon is visible on the map.
Types
PulsingConfig
Flag determining whether the pulsing circle animation is enabled.
The color of the pulsing circle. Can be a processed color number or React Native
ColorValue.Circle radius configuration for the pulsing circle animation:
'accuracy': Pulsing circle animates with thehorizontalAccuracyfrom the latest puck locationnumber: Pulsing circle animates with a constant radius value
Examples
Basic Location Puck
With Heading Indicator
With Course Tracking
With Default Pulsing
With Custom Pulsing
With Custom Images
With Zoom-based Scaling
With Fixed Pulse Radius
Migration from UserLocation
If you’re usingUserLocation with renderMode={UserLocationRenderMode.Native}, migrate to LocationPuck:
See Also
- UserLocation - Legacy user location component with custom rendering
- CustomLocationProvider - Provide custom location data
- Camera - Camera control with
followUserLocationprop