Skip to content

Recenter not working #2

Closed
Closed
@leahtopchik

Description

@leahtopchik

The center param seems to only be working as an initial value, when the value changes the map does not recenter, I have verified the field has been updating.

const mapCenter = useMemo(
    () => ({
      lat: ownItinerary?.destinations[0]?.lat || 0,
      lng: ownItinerary?.destinations[0]?.lon || 0,
    }),
    [ownItinerary]
  );

<GoogleMap
  mapOptions={{
    mapId: process.env.NEXT_PUBLIC_GOOGLE_MAPS_MAP_ID,
    disableDefaultUI: true,
    clickableIcons: true,
  }}
  style={{ width: "100%", height: "100%" }}
  center={mapCenter}
  zoom={5}
  onLoad={() => console.log("Map Component Loaded...")}
>
</GoogleMap>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions