clauderic / react-tiny-virtual-list

A tiny but mighty 3kb list virtualization library, with zero dependencies 💪 Supports variable heights/widths, sticky items, scrolling to index, and more!
https://clauderic.github.io/react-tiny-virtual-list/
MIT License
2.46k stars 165 forks source link

Set initial scrollOffset Not working #8

Closed nontachaiwebdev closed 7 years ago

nontachaiwebdev commented 7 years ago

Hi Now i use react-infinite-calendar.An when i click to show in modal calendar is work fine.But have just a problem.Is initial scrollOffset not set initial scroll position for calendar.I try to Debug in this repo but scrollOffset have value when component mount.

thank you

nontachaiwebdev commented 7 years ago

I found some point is work not fine. This code

getNodeOffset() { const {scrollDirection} = this.props; return this.rootNode[scrollProp[scrollDirection]]; }

this.rootNode[scrollProp[scrollDirection]] => this.rootNode[scrollTop] is undefined

clauderic commented 7 years ago

This is most likely because you're rendering the calendar in a container that is initially set to display: none. It's not possible to set the scrollTop property of a node if it is set to display: none.

Make sure you only render the calendar once your modal is visible.

nontachaiwebdev commented 7 years ago

Oh!!! that right. thankyou