aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/CurrentLocationMap.js
blob: 06aaad0fae8fd6706edd11c62dae111ee6ab6e3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import maplibregl from 'maplibre-gl';
import { useEffect } from 'react';
import { map } from './Map';

const CurrentLocationMap = () => {
  useEffect(() => {
    const control = new maplibregl.GeolocateControl({
      positionOptions: {
        enableHighAccuracy: true,
        timeout: 5000,
      },
      trackUserLocation: true,
    });
    map.addControl(control);
    return () => map.removeControl(control);
  }, []);

  return null;
}

export default CurrentLocationMap;