我想知道是否有任何方法可以在列表末尾添加填充底部。我需要这个,因为我在列表的底部有一个物质浮动按钮。因此,如果用户转到列表的末尾,则该填充将保存要从按钮覆盖的最后一个项目。
谢谢
它不是填充,但你可以在包含所有项目的div中放置一个底部边缘:
.ReactVirtualized__Grid__innerScrollContainer {
margin-bottom: 100px;
}
.ReactVirtualized__Grid__innerScrollContainer[style] {overflow:visible !important;}
react-select
的第9版使用内联样式来设置溢出。我使用了这个,所以工具提示在网格的末尾下方(当网格没有占据整个屏幕时)。请参阅react select library code snippet:
<div
className="ReactVirtualized__Grid__innerScrollContainer"
role={containerRole}
style={{
width: autoContainerWidth ? 'auto' : totalColumnsWidth,
height: totalRowsHeight,
maxWidth: totalColumnsWidth,
maxHeight: totalRowsHeight,
overflow: 'hidden',
pointerEvents: isScrolling ? 'none' : '',
position: 'relative',
...containerStyle,
}}>
您可以设置列表中最后一项的高度以包括填充,因为rowHeight可以传递一个函数。
然后你需要做的就是设置你的列表项的样式,使得最后一项的额外高度是空的空间,边距底部或内部内容的固定高度都可以。
https://github.com/bvaughn/react-virtualized/blob/master/docs/List.md#prop-types。