You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importReactfrom'react';import{MapView,Camera,UserLocation,UserLocationRenderMode}from'@rnmapbox/maps';constaddPoint=()=>{// This function just handles the adding of a point on current location// onPressAddPoint(currentPosition.current ?? [0, 0]);};classBugReportExampleextendsReact.Component{render(){return(<MapViewstyle={{flex: 1}}><CameracenterCoordinate={currentPosition.current??[0,0]}zoomLevel={14}/><UserLocationminDisplacement={1}animatedandroidRenderMode="gps"showsUserHeadingIndicatorrenderMode={UserLocationRenderMode.Native}onUpdate={({coords: { longitude, latitude }})=>{currentPosition.current=[longitude,latitude];}}/></MapView>);}}
Observed behavior and steps to reproduce
I have made a follow location feature. The camera follows the user if he/she is moving.
During the movement, the onUpdate is triggered but it doesnot uPdates the value in "currentPosition.current".
Instead it passes some previous value in the function which came across the movement.
Expected behavior
"currentPosition.current" must be updated properly and should give the exact current value of "currentPosition.current" whenever the addPoint function is called.
Notes / preliminary analysis
I have also tried this on newer versions (10.1.1 to 10.1.15) and the latest version (10.1.27) but no luck.
When i hanged "minDisplacement" value to 5, it started updating the "curretPosition.current" after moving some meters. But i need that to add that point right where i clicked the button (means right where my current location was displayed)
This error only occurs while the location is moving.
Additional links and references
No response
The text was updated successfully, but these errors were encountered:
Mapbox Implementation
Mapbox
Mapbox Version
10.17.0
React Native Version
0.70.15
Platform
iOS, Android
@rnmapbox/maps
version10.0.15
Standalone component to reproduce
Observed behavior and steps to reproduce
I have made a follow location feature. The camera follows the user if he/she is moving.
During the movement, the onUpdate is triggered but it doesnot uPdates the value in "currentPosition.current".
Instead it passes some previous value in the function which came across the movement.
Expected behavior
"currentPosition.current" must be updated properly and should give the exact current value of "currentPosition.current" whenever the addPoint function is called.
Notes / preliminary analysis
I have also tried this on newer versions (10.1.1 to 10.1.15) and the latest version (10.1.27) but no luck.
When i hanged "minDisplacement" value to 5, it started updating the "curretPosition.current" after moving some meters. But i need that to add that point right where i clicked the button (means right where my current location was displayed)
This error only occurs while the location is moving.
Additional links and references
No response
The text was updated successfully, but these errors were encountered: