-
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
[iOS] fix: incorrect ScrollView offset on update #30647
Conversation
Base commit: 89beefa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shergin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Love this PR, I hope this works out! The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my last comment.
@shergin I'm not sure what you mean by fixing the Please let me know if I am on the right or wrong direction of doing this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shergin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Amazing thanks !! |
Sorry for this, but I have always this issue with last RN version, is it normal ? |
Just add this prop --> automaticallyAdjustContentInsets={false} |
Summary
This pull request is to fix #30258.
After an investigation, I found out the scroll offset of the list seems to be calculated incorrectly due to a workaround in the source code.
Instead of fixing the
calculateOffsetForContentSize
, I chose to remove it, the reason why I do so is because this workaround is for fixing the offset whencontentSize
is set manually, but according to the source code, there is no interface for a react-native user to set thecontentSize
of ScrollView, it is just set toGCSizeZero
and will never be changed (ref).Also I changed the function name from
updateContentOffsetIfNeeded
toupdateContentSizeIfNeeded
according what the function is actually doing.Changelog
[iOS] [Fixed] - Incorrect ScrollView offset on update
Test Plan
testapp
using npx create-react-native-apptestapp
from https://snack.expo.io/@lokomass/flatlisttestapp
on iOS emulator and reproduce the bugtestapp/node_modules/react-native/
testapp
and run on iOS emulator again, the bug is no more existScreenshots
Before: The scroll offset is incorrect after children of FlatList has changed
Before.mov
After: No more incorrect scroll offset if children of FlatList has changed
After.mov