Google-maps-react: marker animation

Created on 14 Oct 2017  路  9Comments  路  Source: fullstackreact/google-maps-react

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.

Most helpful comment

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!

All 9 comments

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

Unfortunately now I have error

Cannot read property 'maps' of undefined

@EwaMakowska what version are you using?

also having the same issue.

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

google version: "3.30"

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

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

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!

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.

Unfortunately now I have error

Cannot read property 'maps' of undefined

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

Was this page helpful?
0 / 5 - 0 ratings