Skip to content

Commit e50311b

Browse files
authored
fix: apply center, zoom changes to the map
1 parent e3aad11 commit e50311b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/GoogleMap/index.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ export const GoogleMap = forwardRef<google.maps.Map, GoogleMapProps>(function Go
6767
}
6868

6969
const map = new mapsLib.Map(containerRef.current!, {
70+
...mapOptions,
7071
center: initialCenter || center || mapOptions.center,
7172
zoom: initialZoom || zoom || mapOptions.zoom,
72-
...mapOptions,
7373
});
7474

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

8181
useApplyMapOptions(map, {
8282
...mapOptions,
83+
center: center || mapOptions.center,
84+
zoom: zoom || mapOptions.zoom,
8385
});
8486

8587
useApplyMapEvent(map, {

0 commit comments

Comments
 (0)