[英]Make height of list fill whole page
我目前正在尝试制作一个页面,其中一半是 map,另一半是列表。 我想让列表高度填满整个页面,但我似乎找不到正确的方法。 我使用 react-virtualized 列表代码库作为起点,在该代码中,您通过传入 listHeight 来指定高度维度。 但我希望 listHeight 根据您的屏幕尺寸是动态的。
我试过做 flex: 1, height: 100%,但它似乎不影响代码。 我需要以某种方式使高度值等于屏幕尺寸的尺寸。
<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>
做style = {{height: "100vh"}}
这将占用 window 的整个垂直高度
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.