Adding a (non yet operational) control to get the current location.

This commit is contained in:
vdv committed 2022-11-22 18:03:53 +01:00
1 parent 0f8f892688
commit 0ba385c476
4 files changed
+85 -3

No files matched your search

@@ -0,0 +1,9 @@
.getLocation {
--opacity: 0.6;
--ion-background-color: white;
margin-left: calc(50% - 20px);
position: fixed;
bottom: 6px
;
}
@@ -0,0 +1,47 @@
import React from 'react';
// import { Geolocation } from '@awesome-cordova-plugins/geolocation';
import style from './GetLocation.module.css';
import { IonButton, IonIcon } from '@ionic/react';
import { locateOutline } from 'ionicons/icons';
// import { useAtom } from 'jotai';
// import { setCenterAtom } from '../../App';
// import { locationAtom } from '../map/CurrentLocation';
const GetLocation: React.FC<{}> = () => {
// const [, setCenter] = useAtom(setCenterAtom);
// const [, setLocation] = useAtom(locationAtom);
// const onClickHandler = (event: any) => {
// console.log('Click handler');
// Geolocation.getCurrentPosition().then((position) => {
// console.log(
// `Click handler, position: ${position.coords.latitude}, ${position.coords.longitude}`
// );
// setCenter({
// lat: position.coords.latitude,
// lon: position.coords.longitude,
// });
// setLocation({
// lat: position.coords.latitude,
// lon: position.coords.longitude,
// });
// });
// };
// onClick={onClickHandler}
return (
<IonButton
className={style.getLocation}
shape='round'
size='small'
fill='solid'
>
<IonIcon slot='icon-only' icon={locateOutline} color='white' />
</IonButton>
);
};
export default GetLocation;
+1
View File
@@ -0,0 +1 @@
export { default } from './GetLocation';