reactScrollbar icon indicating copy to clipboard operation
reactScrollbar copied to clipboard

Margin-top when last element deleted

Open vitalie-work opened this issue 9 years ago • 1 comments

My case: I have visible 2 elements. If I scroll to the end of the list and delete the last element before container become smaller but shouldn't because I still have more than 2 elements after and in moment when I scroll container growing to the normal size

Scrolbar.jsx componentWillReceiveProps, when i delete last element, return this:

old props: realSize: 216, containerSize: 72, position: 144 next props: realSize: 180, containerSize: 36, position: 144

but for correct display it should have this props: realSize: 180, containerSize: 72, position: 108

So instead to cut containerSize it should change position

Update: I forgot mentioned, I don't use child component, only a render element function, so I can't use scrollArea.refresh in this situation

vitalie-work avatar Jun 02 '16 14:06 vitalie-work

Hi, found why this happen,

something going wrong when scrollbar wrapper has max-height instead of height,

refresh() can't solve this problem ( console error offsetHeight or everything just disappear )

my solution was: count child elements and when it's < 1 ( in this particular case ) add other class with max-height + height:auto

vitalie-work avatar Jun 09 '16 13:06 vitalie-work