简体   繁体   English

使列表的高度填满整个页面

[英]Make height of list fill whole page

I am currently trying to make a page with a map on one half and a list on the other.我目前正在尝试制作一个页面,其中一半是 map,另一半是列表。 I want to make the list height fill the entire page but I can't seem to find the right way to do so.我想让列表高度填满整个页面,但我似乎找不到正确的方法。 I am using the react-virtualized list codebase as a starting point and in that code you specify the height dimension by passing in listHeight.我使用 react-virtualized 列表代码库作为起点,在该代码中,您通过传入 listHeight 来指定高度维度。 But I want the listHeight to be dynamic based on your screen size.但我希望 listHeight 根据您的屏幕尺寸是动态的。

I've tried doing flex: 1, height: 100%, but it doesn't seem to affect the code.我试过做 flex: 1, height: 100%,但它似乎不影响代码。 I need to somehow make the height value equal to the dimension of the screen size.我需要以某种方式使高度值等于屏幕尺寸的尺寸。

<div style={{flex: 1}}>
    <AutoSizer>
        {({width}) => (
            <List
                ref="List"
                className={styles.List}
                height={listHeight}
                overscanRowCount={overscanRowCount}
                noRowsRenderer={this._noRowsRenderer}
                rowCount={rowCount}
                rowHeight={
                    useDynamicRowHeight ? this._getRowHeight : listRowHeight
                }
                rowRenderer={this._rowRenderer}
                scrollToIndex={scrollToIndex}
                width={width}
            />
        )}
    </AutoSizer>
</div>

do style = {{height: "100vh"}}style = {{height: "100vh"}}

this will take the entire vertical height of the window这将占用 window 的整个垂直高度

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM