Google-maps-react: There's no property 'style' to set the width and height of the map

Created on 15 Aug 2019  路  4Comments  路  Source: fullstackreact/google-maps-react

There's no property 'style' to set the width and height of the map, so there's a compilation error when trying to do something like:
image
So, map is always 100% and doesn't fit to the size I expect.
All examples refer to the 'style' property. Does it existed in previous versions? Is there a way to fix this with the latest version?

Most helpful comment

use containerStyle instead

All 4 comments

I have the same problem with that, there's no way to set the style of the map? In the meantime, I changed directly the google-maps-react code to fit what I want, but that's not a solution

use containerStyle instead

@anselm94 Thank you so much, I was going nuts trying to figure this out lol

Create a variable with all the styles needed. like so:
const mapStyles={ position: "relative", width: "300px", height: "300px" };
then use it inside style = {mapStyles} it should appear as you want.

But make sure to declare the variable before export class ...... extends React.Component {

Was this page helpful?
0 / 5 - 0 ratings

Related issues

colshacol picture colshacol  路  4Comments

cernoel picture cernoel  路  3Comments

kkinaman picture kkinaman  路  3Comments

mruoss picture mruoss  路  5Comments

rullymartanto picture rullymartanto  路  5Comments