Skip to content

Commit

Permalink
refactor: update type for coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
bijayrauniyar0 committed Dec 11, 2024
1 parent 2c08b2a commit d38f3c1
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import '@Components/common/MapLibreComponents/map.css';
import { Button } from '@Components/RadixComponents/Button';
import Skeleton from '@Components/RadixComponents/Skeleton';
import type { MapMouseEvent } from 'maplibre-gl';
import type { LngLatLike, MapMouseEvent } from 'maplibre-gl';
import { Popup } from 'maplibre-gl';
import 'maplibre-gl/dist/maplibre-gl.css';
import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
Expand Down Expand Up @@ -89,7 +89,7 @@ const AsyncPopup = forwardRef<HTMLDivElement, IAsyncPopup>(
const [properties, setProperties] = useState<Record<string, any> | null>(
null,
);
const [coordinates, setCoordinates] = useState<any>(null);
const [coordinates, setCoordinates] = useState<number[]>();
const [isPopupOpen, setIsPopupOpen] = useState(false);

useEffect(() => {
Expand All @@ -116,7 +116,7 @@ const AsyncPopup = forwardRef<HTMLDivElement, IAsyncPopup>(
},
);

setCoordinates(e.lngLat);
setCoordinates(e.lngLat as unknown as number[]);
// popup.setLngLat(e.lngLat);
}
map.on('click', displayPopup);
Expand All @@ -140,7 +140,7 @@ const AsyncPopup = forwardRef<HTMLDivElement, IAsyncPopup>(
/>,
);
popup.setHTML(htmlString).addTo(map);
popup.setLngLat(coordinates);
popup.setLngLat(coordinates as LngLatLike);
setIsPopupOpen(true);
}, [
handleBtnClick,
Expand Down

0 comments on commit d38f3c1

Please sign in to comment.