Skip to main content

UserLocation

import { UserLocation } from '@rnmapbox/maps';

UserLocation

props​

androidRenderMode​

'normal' | 'compass' | 'gps'

native/android only render mode

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

@platform android

animated​

boolean

Whether location icon is animated between updates

defaults to: true

children​

ReactElement | ReactElement[]

Custom location icon of type mapbox-gl-native components

minDisplacement​

number

Minimum amount of movement before GPS location is updated in meters

defaults to: 0 Set Displacement

onPress​

func

Callback that is triggered on location icon press signature:() => void

Show Map

onUpdate​

func

Callback that is triggered on location update signature:(location:Location) => void

User Location Updates

renderMode​

UserLocationRenderMode

@deprecated use LocationPuck component instead of UserLocationRenderMode.Native Which render mode to use.

defaults to: UserLocationRenderMode.Normal User Location Render Mode

requestsAlwaysUse​

boolean

Request the always location permission, and listen to the location even when the app is in background

@platform ios

defaults to: false

showsUserHeadingIndicator​

boolean

Show or hide small arrow which indicates direction the device is pointing relative to north.

defaults to: false

visible​

boolean

Whether location icon is visible

defaults to: true User Location Render Mode

methods​

setLocationManager({ running }: { running?: boolean })​

Whether to start or stop listening to the locationManager

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

arguments​

NameTypeRequiredDescription
{ running }: { running?: boolean }{running?:boolean}Yesundefined

needsLocationManagerRunning()​

If locationManager should be running

arguments​

NameTypeRequiredDescription