-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
FlatList snapToInterval is not precise in long list #21441
Comments
There is a similar issue on Android and horizontal ScrollView with devices like the Nexus 5X which apparently has a screen width of |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions. |
Not me. I had to change my UI to account for this |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
stale bot, this is still an issue as far as I know |
I'm also having this issue as well |
To anyone else facing this: I got around this issue by using snapToOffsets to achieve the same effect. |
Having the same issue! |
snapToOffsets solved it for me too. I just calculated the stops of the next snap by the number of items and the margin between them. for example:
|
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
not stale |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
not stale |
@ttaallll I believe I also solved it like this. I haven't measured it, but I'd think you'd take a hit in performance (especially for large data sources), so I wouldn't consider this a final solution. |
Still an issue |
thank you so much for sharing....this was the only thing that worked for me. |
Thanks ! I don't know why but for my case I had to remove and don't use the |
This improved my experience. Thanks! |
Still facing this issue with RN 0.70.6 .I used @ttaallll workaround, thank you. |
Encountered the same issue on horizontal list with 1000 items of the same width. Switching to Giving the component a fixed width (to avoid the floating point widths) also didn't resolve the issue. Setting |
I'm finding this to only be an issue when setting a custom |
I found in native code that the type of |
Same issue exist's for me too in some android devices. It happens for my vertical posts (Full device height) inside FlatList. Although the workaround mentioned above fixed the issue but now there is black margin of 5 pixels appearing in between the posts which makes my UI a bit odd. Would be good if this issue get's fixed in a proper way. |
Bump |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
Still facing this issue |
Environment
Description
I'm using the FlatList component with around 50 elements. When my element height (and subsequently snapToInterval prop) are set to floats, rather than integers, there seems to be a proportionality increasing offset from the correct interval to snap to. The affect of this is very noticeable with a lot of elements. The further I scroll down a list the bigger the offset, so that when I get to the bottom, it's very noticeable.
This offset is still there with integers, but it's a lot less pronounced.
Screenshots:
First two are with height set to
105.14285714285714
, which is an iPhone 6s Plus' height divided by seven. The last two have height set to105
, which is just the truncated version of the previous height.Height: 105.14285714285714 (at bottom):
Height: 105.14285714285714 (second from top):
Height: 105 (at bottom):
Height: 105 (second from top):
Reproducible Demo
https://snack.expo.io/@elliotschep/flatlist-snaptointerval-is-not-precise-in-long-list
The text was updated successfully, but these errors were encountered: