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

Slider doesn't work in a horizontal scrolling container on web (e.g. tab view) #471

Closed
motiz88 opened this issue Dec 27, 2022 · 0 comments · Fixed by #472
Closed

Slider doesn't work in a horizontal scrolling container on web (e.g. tab view) #471

motiz88 opened this issue Dec 27, 2022 · 0 comments · Fixed by #472
Labels
bug report Something isn't working

Comments

@motiz88
Copy link
Contributor

motiz88 commented Dec 27, 2022

Environment

N/A, reproduces on Snack

Description

If a slider is rendered inside a container that can scroll horizontally, the cached container X position is not cleared on scroll, which throws off the calculation in getValueFromNativeEvent and makes the slider unusable.

One implication of this - and where it bit me - is that the component can't be used reliably inside a tab view that relies on scrolling (e.g. @react-navigation/material-top-tabs). This manifests as sliders being completely unresponsive on all tabs except the one that was initially opened during the tab view's first render.

Reproducible Demo

https://snack.expo.dev/@motiz88/slider-horizontal-slide-bug

Screen.Recording.2022-12-27.at.18.10.55.mov
@motiz88 motiz88 added the bug report Something isn't working label Dec 27, 2022
@motiz88 motiz88 changed the title Slider doesn't work in a horizontal scrolling container on web (e.g. TabView) Slider doesn't work in a horizontal scrolling container on web (e.g. tab view) Dec 27, 2022
motiz88 added a commit to motiz88/react-native-slider that referenced this issue Dec 27, 2022
Fixes callstack#471. Added a test case to `example-web`.
motiz88 added a commit to motiz88/react-native-slider that referenced this issue Dec 27, 2022
Fixes callstack#471. Added a test case to `example-web`.
motiz88 added a commit to motiz88/react-native-slider that referenced this issue Dec 27, 2022
Fixes callstack#471. Added a test case to `example-web`.
motiz88 added a commit to motiz88/react-native-slider that referenced this issue Dec 27, 2022
Fixes callstack#471. Added a test case to `example-web`.
BartoszKlonowski added a commit that referenced this issue Jan 13, 2023
* fix(web): invalidate position on ancestor scroll

Fixes #471. Added a test case to `example-web`.

* Use const isAlreadyInvalidated instead of a comment

Co-authored-by: Bartosz Klonowski <70535775+BartoszKlonowski@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant