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

scrollToPage doesn't work when animated = false #54

Open
tadasstra opened this issue Dec 1, 2020 · 0 comments
Open

scrollToPage doesn't work when animated = false #54

tadasstra opened this issue Dec 1, 2020 · 0 comments

Comments

@tadasstra
Copy link

scrollToPage doesn't work when animated = false. That happens because of this:

requestAnimationFrame(() => {
        this.scrollToPage(Math.floor(this.progress), false);
});

After scrollToPage it calls scrollToPage second time and goes back to 0 page.

Quick hack to override this issue (hopefully we can see a fix next version and we don't need this dirty hack):

//Set scrollState to 1 before scrolling
pager.current.scrollState = 1;
pager.current.scrollToPage(0, false)

//Make scrollState to 0 zero after scroll will finish
setTimeout(() => {
      pager.current.scrollState = 0
}, 100)

Thanks!!!

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

No branches or pull requests

1 participant