current heading
#3727
-
Is there any method that I can get the current heading (bearing) value? |
Beta Was this translation helpful? Give feedback.
Answered by
akifbora
Dec 20, 2024
Replies: 2 comments 3 replies
-
It is not documented but it is possible to subscribe to the locationManager which returns an event with a heading. It is used in the UserLocation component import { locationManager } from '@rnmapbox/maps'
const onLocationHandler = (event) => {
if(event?.coords?.heading){
//
}
}
locationManager.addListener(onLocationHandler)
locationManager.start()
locationManager.removeListener(onLocationHandler)
// careful when stopping the location manager as this can stop
// the user location update in a map view if it is being used
locationManager.stop() |
Beta Was this translation helpful? Give feedback.
3 replies
-
I got it. there is no method to get current bearing and pitch on mapRef. I implemented and I will send a pull request if needed. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
akifbora
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got it. there is no method to get current bearing and pitch on mapRef. I implemented and I will send a pull request if needed.