ShowLocation component.
This commit is contained in:
1 parent
1555c00fe8
commit
2fa6199979
5 files changed
+107
-11
No files matched your search
@@ -3,7 +3,5 @@
|
||||
--ion-background-color: white;
|
||||
margin-left: calc(50% - 20px);
|
||||
position: fixed;
|
||||
bottom: 6px
|
||||
;
|
||||
bottom: 6px;
|
||||
}
|
||||
|
||||
@@ -7,12 +7,15 @@ import { IonButton, IonIcon } from '@ionic/react';
|
||||
import { locateOutline } from 'ionicons/icons';
|
||||
import { useAtom } from 'jotai';
|
||||
import { stateAtom } from '../map';
|
||||
import { locationAtom } from '../show-location';
|
||||
|
||||
// import { locationAtom } from '../map/CurrentLocation';
|
||||
|
||||
const GetLocation: React.FC<{}> = () => {
|
||||
const [state, setState] = useAtom(stateAtom);
|
||||
|
||||
const [, setLocation] = useAtom(locationAtom);
|
||||
|
||||
const onClickHandler = (event: any) => {
|
||||
console.log('Click handler');
|
||||
Geolocation.getCurrentPosition().then((position) => {
|
||||
@@ -22,6 +25,7 @@ const GetLocation: React.FC<{}> = () => {
|
||||
rotation: state.rotation,
|
||||
center: [position.coords.longitude, position.coords.latitude],
|
||||
});
|
||||
setLocation([position.coords.longitude, position.coords.latitude]);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user