I am implementing a map component using the @vis.gl/react-google-maps library in a React application. I want the map to behave like Google Maps, where I can search for a place, set a marker, and then freely move and zoom the map without restrictions.
Here is the code for my component:
enter image description here enter image description hereenter image description here
What I Tried:
Setting controlled={false} on the <Mapa> component to allow free movement and zoom.
Adjusting the gestureHandling property to 'greedy'.
Ensuring the handleIdle function updates the center and zoom state based on the map's current state.
Expected Behavior:
I expect the map to allow free movement and zooming after setting a marker at the searched location, similar to how Google Maps behaves.
Actual Result:
When I search for a location, the map centers on that location and places a marker, but I cannot freely move or zoom the map. It seems to be stuck with a defined center and does not respond to gestures properly. The map trembles when I try to move it, and zooming does not work as expected.
Óscar Javier Hernández Gómez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.