Reflect user pin location change if user manually overrides location

This commit is contained in:
Keannu Bernasol 2023-09-22 23:08:54 +08:00
parent 7da7d0f217
commit 19d19c3dd5

View file

@ -243,8 +243,12 @@ export default function Home() {
minZoomLevel={19} minZoomLevel={19}
zoomTapEnabled zoomTapEnabled
initialRegion={{ initialRegion={{
latitude: location.coords.latitude, latitude:
longitude: location.coords.longitude, student_status?.location?.latitude ||
location.coords.latitude,
longitude:
student_status?.location?.longitude ||
location.coords.longitude,
latitudeDelta: 0.4, latitudeDelta: 0.4,
longitudeDelta: 0.4, longitudeDelta: 0.4,
}} }}
@ -372,11 +376,16 @@ export default function Home() {
} }
)} )}
<Marker <Marker
zIndex={1001}
coordinate={{ coordinate={{
latitude: location.coords.latitude, latitude:
longitude: location.coords.longitude, student_status?.location?.latitude ||
location.coords.latitude,
longitude:
student_status?.location?.longitude ||
location.coords.longitude,
}} }}
draggable={student_status?.active} draggable={!student_status?.active}
onDragEnd={(e) => { onDragEnd={(e) => {
const newLocation = e.nativeEvent.coordinate; const newLocation = e.nativeEvent.coordinate;
const distance = GetDistance( const distance = GetDistance(