Replies: 2 comments 5 replies
-
A small addition, we have a So instead of const [instance, setInstance] = useState<google.maps.marker.AdvancedMarkerElement | null>(null);
const setMarkerRef = (markerRef: google.maps.marker.AdvancedMarkerElement | null) => {
if (instance === null) {
if (markerRef) {
setInstance(markerRef);
}
}
}; You can use import {useAdvancedMarkerRef} from '@vis.gl/react-google-maps';
// ...
const [markerRef, marker] = useAdvancedMarkerRef(); Then you can pass Besides that the code looks pretty good, and the animation stopping when clicked it doesn't seem to have anything to do with the code you shared. In the future it should be as simple as specifying the className prop for the marker, but that isn't implemented yet. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply, I see there is a Hook that handles marker refs.
In this case, the marker animates only for a split second when it appears on the map, and then stops working without clicking. |
Beta Was this translation helpful? Give feedback.
-
I want to reproduce the Drop and Bounce animation of the old Marker class using advancedMarker + Pin Component.
In the code below, .bounce is added to div.GMAMP-maps-pin-view and the bounce animation is working correctly, but when I click on the Marker, the .bounce is removed and the animation stops.
I could not find a method to animate AdvancedMarkerComponent in the docs, example, so I used https://developers.google.com/maps/documentation/javascript/examples/ advanced-markers-animation
as a reference.
Is this the wrong method to begin with?
css
Beta Was this translation helpful? Give feedback.
All reactions