React-google-maps: Adding position absolute onto the map container gets overwritten

Created on 4 Aug 2016  路  6Comments  路  Source: tomchentw/react-google-maps

Whenever I try to pass any position attribute into the styling for the container element, it gets overwritten by position: relative

Most helpful comment

I'm having the same issue, the mapElement div has a position: relative and the map does not show up on my page

Happen to me on 6.0.0 and 4.11.0 with Meteor and Bootstrap 3.3.6

It's possible to overcome the problem by putting the height of the map element in viewport height and not in percentage

mapElement={
   <div style={{ height: '100vh' }} />
}

All 6 comments

try adding !important after absolute

I'm having the same issue, the mapElement div has a position: relative and the map does not show up on my page

Happen to me on 6.0.0 and 4.11.0 with Meteor and Bootstrap 3.3.6

It's possible to overcome the problem by putting the height of the map element in viewport height and not in percentage

mapElement={
   <div style={{ height: '100vh' }} />
}

@ASpehler would it possible to put it in containerElement with v6.0.0 and still work? I'm asking because mapElement is the actual DOM that Google Maps JavaScript API will render its DOMs on, and containerElement is just a wrapper around it.

@tomchentw yes it works too

containerElement={
   <div style={{ height: '100vh' }} />
}
mapElement={
   <div style={{ height: '100%' }} />
}

Thanks @ASpehler for the feedback!

@nodegin @deadlocked247 did this solve your issue?

Please refer to Getting Help section in the README (or #469).

Was this page helpful?
0 / 5 - 0 ratings