We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unable to zoom in, zoom out, or drag the map.
Whole Code
import { APIProvider, InfoWindow, Map, Marker, useMarkerRef, } from "@vis.gl/react-google-maps"; import { useState } from "react"; interface Props { lat: number; lng: number; fullAddress: string; } export const GoogleMap = ({ lat, lng, fullAddress }: Props) => { const position = { lat, lng }; const [markerRef, marker] = useMarkerRef(); const [isInfoWindowOpen, setIsInfoWindowOpen] = useState(true); const toggleInfoWindowStatus = (state?: boolean) => setIsInfoWindowOpen((previousState) => !previousState); return ( <APIProvider apiKey={process?.env?.NEXT_PUBLIC_GOOGLE_MAP_API_KEY as string} > <Map center={position} zoom={14} className="h-60 w-full rounded-md border border-C_E1E1E1" > <Marker position={position} ref={markerRef} onClick={() => toggleInfoWindowStatus(true)} /> {isInfoWindowOpen && ( <InfoWindow anchor={marker} onCloseClick={() => toggleInfoWindowStatus(false)} > <span className="line-clamp-2 break-words">{fullAddress}</span> </InfoWindow> )} </Map> </APIProvider> ); };
NA
The text was updated successfully, but these errors were encountered:
That was a recent change we did to the API, we are now using center/defaultCenter props like React-form elements. If you don't want to deal with the state, you can use defaultCenter/defaultZoom. See here: https://visgl.github.io/react-google-maps/docs/api-reference/components/map#controlled-and-uncontrolled-props
center
defaultCenter
defaultZoom
Sorry, something went wrong.
(feel free to reopen if that doesn't solve your issue)
Thanks a lot. It worked.
No branches or pull requests
Description
unable to zoom in, zoom out, or drag the map.
Steps to Reproduce
Whole Code
Environment
Logs
The text was updated successfully, but these errors were encountered: