Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paddings not taken into account in reverse mode #216

Closed
morajabi opened this issue Oct 23, 2023 · 5 comments · Fixed by #217 or #230
Closed

Paddings not taken into account in reverse mode #216

morajabi opened this issue Oct 23, 2023 · 5 comments · Fixed by #217 or #230
Assignees

Comments

@morajabi
Copy link

morajabi commented Oct 23, 2023

Describe the bug
I set a paddingTop and paddingBottom on <VList> in reverse mode. I have a function to scroll to bottom (scrollToIndex(length - 1, "end")). Scroll happens but goes to destinationScrollOffset - paddingTop - paddingBottom (I mean it doesn't properly scroll to the item)

To Reproduce
Steps to reproduce the behavior.

  • Enable reverse mode
  • Add style={{ paddingTop: 60 }} to VList
  • Run scrollToIndex(length - 1) to scroll to last item
  • Notice it stays 60px before to the item.

Expected behavior
A clear and concise description of what you expected to happen.
It should take into account paddings when calculating final scroll position.

Platform:

  • OS: MacOS
  • Browser: Chrome, Safari
  • Version of react: 18
  • Version of this package: 0.14

Additional context
We use Radix scrollview as the root element like the example provided in storybook.
My usecase: I want to add 12px padding bottom to avoid chat messages sticking to my compose input. Also, add 48px paddingTop because I'm placing a blurred header (as the topbar) on top of messages via position absolute and without the padding the top most message will be behind the header element.

P.S. we'd love a new release with latest changes! particularly talking about smooth scrolling & align center :)

@inokawa
Copy link
Owner

inokawa commented Oct 24, 2023

Thank you for reporting!
I hope this was fixed in 0.15.0.

@morajabi
Copy link
Author

@inokawa
Thank you! Padding bottom is fixed. However, paddingTop is still not taken into account.
Say I have 60px of paddingTop, when I scrollToIndex, it is 60px off in v0.15.

@dena-sohrabi
Copy link

@inokawa inokawa reopened this Oct 24, 2023
@inokawa
Copy link
Owner

inokawa commented Oct 24, 2023

Thank you for the additional information.

I'll try to fix it again but if you hurry using some spacer item like <div style={{height: 60}}/> instead of padding may work as a workaround (Of course you have to add +1 to the destination index though).

@inokawa
Copy link
Owner

inokawa commented Oct 27, 2023

Probably fixed in 0.15.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants