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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallax: scrollTo not executing correctly #1454

Closed
kindoflew opened this issue Apr 23, 2021 · 0 comments 路 Fixed by #1455
Closed

Parallax: scrollTo not executing correctly #1454

kindoflew opened this issue Apr 23, 2021 · 0 comments 路 Fixed by #1455

Comments

@kindoflew
Copy link
Collaborator

馃悰 Bug Report

After playing with the sandbox demos last night, I noticed that the scrollTo function in parallax only ever scrolled to 0 and that it wasn't animated. After digging a little bit I discovered that the value of scroll in the controller was being passed into onChange incorrectly(?) here.

Currently it looks like this:

onChange({ scroll }: any) {
  container[scrollType] = scroll
}

I got it to work by changing it to this:

onChange({ value: {scroll} }: any) {
  container[scrollType] = scroll
}

I don't know anything about the new API, but some liberally placed console.logs revealed that in the current version, scroll always equals undefined in onChange.

I have a PR in the works, but wanted to open an issue first for better documentation history.

To Reproduce

Steps to reproduce the behavior:

  • Attach a click listener to any content nested in Parallax and pass scrollTo in and click.
  • If Parallax is at scrollTop === 0, nothing will happen, even if the offset passed to the function is positive.
  • If Parallax is at scrollTop > 0 then Parallax will jump to the top without animating, no matter what offset is passed.

Expected behavior

Parallax should perform an animated scroll to the entered offset.

Link to repro (highly encouraged)

sandbox demo: parallax vert

Environment

  • react-spring v9.1.2
  • react v17.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant