Skip to main content

<UserLocation />

Props

PropTypeDefaultRequiredDescription
animatedbooleantruefalseWhether location icon is animated between updates
renderMode"normal" | "native""normal"falseWhich render mode to use.
Can either be normal or native
androidRenderMode"normal" | "compass" | "gps"nonefalsenative/android only render mode

- normal: just a circle
- compass: triangle with heading
- gps: large arrow

@platform android
visiblebooleantruefalseWhether location icon is visible
showsUserHeadingIndicatorbooleanfalsefalseShow or hide small arrow which indicates direction the device is pointing relative to north.
minDisplacementnumber0falseMinimum amount of movement before GPS location is updated in meters
androidPreferredFramesPerSecondnumbernonefalseAndroid only. Set max FPS at which location animators can output updates. Use this setting to limit animation rate of the location puck on higher zoom levels to decrease the stress on the device's CPU which can directly improve battery life, without sacrificing UX.

@platform android
childrenReactNodenonefalseCustom location icon of type mapbox-gl-native components

NOTE: Forking maintainer does not understand the above comment.

Methods

setLocationManager({<br/> running,<br/>}: {<br/> running: boolean;<br/>})

Whether to start or stop listening to the LocationManager

Notice, that listening will start automatically when
either onUpdate or visible are set

Arguments

NameTypeRequiredDescription
{<br/> running,<br/>}: {<br/> running: boolean;<br/>}{running:boolean;}Yesundefined

needsLocationManagerRunning()

If LocationManager should be running