bvaughn / react-virtualized-auto-sizer

Standalone version of the AutoSizer component from react-virtualized
MIT License
603 stars 82 forks source link

bailoutOnChildren causes remounts #85

Closed chrisnojima closed 6 months ago

chrisnojima commented 6 months ago

Hey,

I'm building an app that uses react navigation which includes a tab navigation. When a tab isn't selected I'm hiding the parent screens using display: none so I can retain scrolling positions as users tab around the app. I noticed that one of my lists was losing its scroll and entirely being remounted and it's due to the usage of the ResizeObserver calling the onResize callback while the screen is in this state. Previously it'd just render but now since bailoutOnChildren is true (due to the rect being 0x0) it'll render no children, then when you tab back it'll render again. It might be nice to have a flag to control if this bail out happens

Thanks!

bvaughn commented 6 months ago

Hmm... that makes sense. Let me think about it a bit.

bvaughn commented 6 months ago

There's a new prop in react-virtualized-auto-sizer@1.0.24 called doNotBailOutOnEmptyChildren that will do what you want


❤️ → ☕ givebrian.coffee

chrisnojima commented 6 months ago

Thanks a bunch!