Google-maps-react: inline styles on the map container are breaking my view

Created on 25 Oct 2016  路  6Comments  路  Source: fullstackreact/google-maps-react

    container: {
      position: 'absolute',
      width: '100vw',
      height: '100vh'
    }

is causing the map to leave my container

it used to be

    container: {
      position: 'absolute',
      width: '100%',
      height: '100%'
    },

and it worked just fine.

Most helpful comment

@kevinSuttle, it looks like you're just changing the map style, but not the container style. Try including:

containerStyle={{position: 'relative'}}

as well.

All 6 comments

You can override this through the Map component's containerStyle prop:

const containerStyle = {position: 'absolute', width: '100%', height:'100%'}

<Map google={this.props.google} containerStyle={containerStyle}/>

I used the following and absolute was still being set.

style={{position: 'relative', width: '93.5%', height: '400px' }}
#map {
  position: relative !important;
}

@kevinSuttle, it looks like you're just changing the map style, but not the container style. Try including:

containerStyle={{position: 'relative'}}

as well.

Thanks!

Can this issue be closed?

if I do position: relative map is not displaying..

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Vijayan-Murugan picture Vijayan-Murugan  路  4Comments

antonk52 picture antonk52  路  5Comments

cernoel picture cernoel  路  3Comments

kevinSuttle picture kevinSuttle  路  4Comments

lishi500 picture lishi500  路  4Comments