-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
ScrollView snapToInterval/snapToOffsets not working when the scrollView width is a float number in IOS. #48393
Comments
Tip Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - 0.76.5. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |
Tip Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |
@shubhamguptadream11, I have validated the repro, please update the label. |
I was not able to repro this locally in vanilla RN, but was in Expo. |
I met this problem in the newest vanilla RN(0.76.5) too, providing repro with expo just for convenient. |
Thanks @hiyuki , do you have a vanilla RN reproducer repo you can share? I'm unable to repro it. |
Yes, here it is, same as expo repro:
Expected result, snapToInterval works : Simulator.Screen.Recording.-.iPhone.15.Pro.-.2025-01-06.at.19.52.25.mp4Unexpected result, snapToInterval does't work: Simulator.Screen.Recording.-.iPhone.15.Pro.-.2025-01-06.at.19.52.52.mp4 |
Description
ScrollView snapToInterval/snapToOffsets not working when the scrollView width is a float number in IOS, because
isHorizontal
method inRCTEnhancedScrollView
return a unexpected result when the width is a float.In my reproducer: https://snack.expo.dev/@hiyuki/scrollview-snaptointerval-bug, when i set scrollView's width with a integer, such as
100
, snapToInterval/snapToOffsets works fine, but when i set the width with a float number, such as100.3
, snapToInterval/snapToOffsets does't work.Steps to reproduce
React Native Version
0.76.5
Affected Platforms
Runtime - iOS
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://snack.expo.dev/@hiyuki/scrollview-snaptointerval-bug
Screenshots and Videos
set ScrollView's width with 100.3, snapToInterval/snapToOffsets does't work.
63_1735194854.mp4
set ScrollView's width with 100, snapToInterval/snapToOffsets works fine.
64_1735194855.mp4
The text was updated successfully, but these errors were encountered: