fullstackreact / google-maps-react

Companion code to the "How to Write a Google Maps React Component" Tutorial
https://www.fullstackreact.com/articles/how-to-write-a-google-maps-react-component/
MIT License
1.64k stars 819 forks source link

marker animation #133

Open EwaMakowska opened 6 years ago

EwaMakowska commented 6 years ago

OK, now I want to use marker animation, but I can't find some official example.

I found solution (https://stackoverflow.com/questions/44729776/how-can-animation-be-added-to-markers-in-react-google-maps) where I do it exacly like in vanilia javaScript. Just adding animation={google.maps.Animation.DROP} to marker:

                <Marker 
                    title={}
                    name={}
                    position={}
                    animation={google.maps.Animation.DROP}
                />

but then I have error

google is not defined

And, unfortunately, adding /global google/ at the top of my js won't help.

So please, advice me how to add marker animation using google-maps-react.

vegtelenseg commented 6 years ago

this.props.google.maps.Animation.DROP should work.

EwaMakowska commented 6 years ago

Unfortunately now I have error

Cannot read property 'maps' of undefined

auser commented 6 years ago

@EwaMakowska what version are you using?

tbowdollar commented 6 years ago

also having the same issue.

"google-maps-react": "^1.1.4",

google version: "3.30"

hajczek commented 6 years ago

And what about this error? Because I have the same problem ....

auser commented 6 years ago

Can you make a runnable example? Check the readme for more info on how to do that.

WilliamVelazquez commented 6 years ago

I'm using the version "2.0.2" and it's working! <Marker title={} name={} position={} animation={this.props.google.maps.Animation.DROP} /> Just like @vegtelenseg said!

php7webmob commented 5 years ago

Can I set trigger time for this because as soon as the Map component is loaded my animation is already complete and can not see the effects of it.

akber777 commented 3 years ago

Unfortunately now I have error

Cannot read property 'maps' of undefined

try this animation={2} or animation={1 to 4}