Skip to content

Commit

Permalink
fix: apply center, zoom changes to the map
Browse files Browse the repository at this point in the history
  • Loading branch information
pyjun01 authored Apr 17, 2024
1 parent e3aad11 commit e50311b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/GoogleMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ export const GoogleMap = forwardRef<google.maps.Map, GoogleMapProps>(function Go
}

const map = new mapsLib.Map(containerRef.current!, {
...mapOptions,
center: initialCenter || center || mapOptions.center,
zoom: initialZoom || zoom || mapOptions.zoom,
...mapOptions,
});

setMap(map);
Expand All @@ -80,6 +80,8 @@ export const GoogleMap = forwardRef<google.maps.Map, GoogleMapProps>(function Go

useApplyMapOptions(map, {
...mapOptions,
center: center || mapOptions.center,
zoom: zoom || mapOptions.zoom,
});

useApplyMapEvent(map, {
Expand Down

0 comments on commit e50311b

Please sign in to comment.