Skip to content

Commit

Permalink
Merge pull request #27574 from nahid633/fix/request-map-cut-off
Browse files Browse the repository at this point in the history
Fix/request map cut off
  • Loading branch information
neil-marcellini authored Sep 20, 2023
2 parents b341d28 + e2ce219 commit e2a1343
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/components/MapView/MapView.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,21 @@ const MapView = forwardRef<MapViewHandle, MapViewProps>(
map.fitBounds([northEast, southWest], {padding: mapPadding});
}, [waypoints, mapRef, mapPadding]);

useEffect(() => {
if (!mapRef) {
return;
}

const resizeObserver = new ResizeObserver(() => {
mapRef.resize();
});
resizeObserver.observe(mapRef.getContainer());

return () => {
resizeObserver?.disconnect();
};
}, [mapRef]);

useImperativeHandle(
ref,
() => ({
Expand Down

0 comments on commit e2a1343

Please sign in to comment.