Reformating

This commit is contained in:
Eric van der Vlist 2022-09-02 11:05:50 +02:00
parent 8ec7e7d045
commit 3dfbd648b7
1 changed files with 18 additions and 18 deletions

View File

@ -1,7 +1,7 @@
import react from "react";
import { useState, useEffect } from "react";
import { Map, Marker, ZoomControl } from "pigeon-maps"
import { Geolocation } from "@awesome-cordova-plugins/geolocation";
import react from 'react';
import { useState, useEffect } from 'react';
import { Map, Marker, ZoomControl } from 'pigeon-maps';
import { Geolocation } from '@awesome-cordova-plugins/geolocation';
const LiveMap: react.FC = () => {
const initialCenter: [number, number] = [44.73574, 6.18981];
@ -10,27 +10,27 @@ const LiveMap: react.FC = () => {
const [position, setPosition] = useState(initialCenter);
const [zoom, setZoom] = useState(initialZoom);
useEffect(()=>{
Geolocation.getCurrentPosition().then((position) =>
{
useEffect(() => {
Geolocation.getCurrentPosition().then((position) => {
setCenter([position.coords.latitude, position.coords.longitude]);
setPosition([position.coords.latitude, position.coords.longitude]);
}
);
}, [])
});
}, []);
return (
<Map center={center} zoom={zoom} onBoundsChanged={
({center, zoom}) => {
<Map
center={center}
zoom={zoom}
onBoundsChanged={({ center, zoom }) => {
setCenter(center);
setZoom(zoom);
}
} animate={true}>
<ZoomControl />
}}
animate={true}
>
<ZoomControl />
<Marker width={20} anchor={position} />
</Map>
);
);
};
export default LiveMap;