如何更新Kepler.gl MapBox组件样式

How to update Kepler.gl MapBox component style

我正在尝试了解如何自定义 kepler.gl 的地图框样式。我想让mapbox组件填满屏幕的宽度和高度。

我已经尝试使用调度程序更新它但没有成功:

this.props.dispatch(loadCustomMapStyle({inputStyle: {url: 'mapbox://styles/mapbox/navigation-guidance-day-v4', id: 'some-id', style: {width: '100%', height: '100%'}}}));

this.props.dispatch(addCustomMapStyle());

我也试过使用样式组件 ThemeProvider:

<ThemeProvider theme={{width: '100%', height:'100%'}}>
            <KeplerGl
                id="foo"
                mapboxApiAccessToken={'API_KEY'}
                store={store}
              />
</ThemeProvider>

如有任何帮助,我们将不胜感激!

KeplerGl 组件接收 widthheight 属性(文档 here). To change these with the dimensions of a div, you can use AutoSizer。例如,要让 KeplerGl 组件填充屏幕,您可以将其包裹在 div即全屏如下:

import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer';

...

<div style={{position: "absolute", width: "100%", height: "100%"}}> 
    <AutoSizer>
        {({height, width}) => (
            <KeplerGl
                mapboxApiAccessToken={MAPBOX_TOKEN}
                id="map"
                width={width}
                height={height}
            />  
        )}  
    </AutoSizer>
</div>