Closed ErikBooij closed 5 years ago
Unfortunately you cannot use height: 100%
with react-tiny-virtual-list
if the scroll direction is vertical.
See this note in the readme:
- Width may only be a string when scrollDirection is 'vertical'. Similarly, Height may only be a string if scrollDirection is 'horizontal'
The reason being react-tiny-virtual-list
uses the computed height value to determine how many items need to be rendered within the visible bounds of the container. You'll have to dynamically measure the container before rendering the VirtualList
Unfortunately you cannot use
height: 100%
withreact-tiny-virtual-list
if the scroll direction is vertical.See this note in the readme:
- Width may only be a string when scrollDirection is 'vertical'. Similarly, Height may only be a string if scrollDirection is 'horizontal'
The reason being
react-tiny-virtual-list
uses the computed height value to determine how many items need to be rendered within the visible bounds of the container. You'll have to dynamically measure the container before rendering the VirtualList
I understand what you mean, but I'm confused about what you said in the readme:
Width may only be a string when scrollDirection is 'vertical'.
I think it should be "Height may only be a Number when scrollDirection is 'vertical'.", isn't it?
Hi! I'm not a 100% sure if this is an actual issue, or if I'm just using it wrong, but I have a variable-height container in which I render a
VirtualList
with itsheight
set to"100%"
. This renders only the first item plus theoverscanCount
.Here's an example of what I'm seeing, I've changed two things after forking your example, I've set the height of
#root
to 500px and I've set the height ofVirtualList
to 100%: https://codesandbox.io/s/nr91pm8mx0Could you advise me if this is actually a bug, or if I'm doing something stupid?