Reformating
This commit is contained in:
parent
8ec7e7d045
commit
3dfbd648b7
|
@ -1,7 +1,7 @@
|
||||||
import react from "react";
|
import react from 'react';
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from 'react';
|
||||||
import { Map, Marker, ZoomControl } from "pigeon-maps"
|
import { Map, Marker, ZoomControl } from 'pigeon-maps';
|
||||||
import { Geolocation } from "@awesome-cordova-plugins/geolocation";
|
import { Geolocation } from '@awesome-cordova-plugins/geolocation';
|
||||||
|
|
||||||
const LiveMap: react.FC = () => {
|
const LiveMap: react.FC = () => {
|
||||||
const initialCenter: [number, number] = [44.73574, 6.18981];
|
const initialCenter: [number, number] = [44.73574, 6.18981];
|
||||||
|
@ -11,22 +11,22 @@ const LiveMap: react.FC = () => {
|
||||||
const [zoom, setZoom] = useState(initialZoom);
|
const [zoom, setZoom] = useState(initialZoom);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Geolocation.getCurrentPosition().then((position) =>
|
Geolocation.getCurrentPosition().then((position) => {
|
||||||
{
|
|
||||||
setCenter([position.coords.latitude, position.coords.longitude]);
|
setCenter([position.coords.latitude, position.coords.longitude]);
|
||||||
setPosition([position.coords.latitude, position.coords.longitude]);
|
setPosition([position.coords.latitude, position.coords.longitude]);
|
||||||
}
|
});
|
||||||
);
|
}, []);
|
||||||
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Map center={center} zoom={zoom} onBoundsChanged={
|
<Map
|
||||||
({center, zoom}) => {
|
center={center}
|
||||||
|
zoom={zoom}
|
||||||
|
onBoundsChanged={({ center, zoom }) => {
|
||||||
setCenter(center);
|
setCenter(center);
|
||||||
setZoom(zoom);
|
setZoom(zoom);
|
||||||
}
|
}}
|
||||||
} animate={true}>
|
animate={true}
|
||||||
|
>
|
||||||
<ZoomControl />
|
<ZoomControl />
|
||||||
<Marker width={20} anchor={position} />
|
<Marker width={20} anchor={position} />
|
||||||
</Map>
|
</Map>
|
||||||
|
|
Loading…
Reference in New Issue