You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In general, I am trying to preserve scroll position when a user navigates away from a ListView and then back again.
Display a or (I'm using SectionList for my use case) with 1000 items à ~50 pixels height
In componentDidMount scroll to an offset that is deep down the list (e.g. offset 1000). You can use the scrollTo method of the underlying ref (this.sectionList._wrapperListRef._listRef) or implement getItemLayout and use scrollToLocation*
Wrap the scrollTo* call in a setTimeout(... scrollTo ..., 0)
Expected Behavior
On Android it should scroll until the desired position, just like on iOS.
Actual Behavior
-> On iOS it is working, on Android it will only scroll until the 10th item, because only 10 items are rendered initally
Workaround: Setting initialNumToRender to 1000 will work, but this might crash on low end devices.
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
react-native -v
: 0.46.4node -v
: 8.1.4npm -v
: 5.3.0yarn --version
: 0.27.5Then, specify:
Steps to Reproduce
In general, I am trying to preserve scroll position when a user navigates away from a ListView and then back again.
componentDidMount
scroll to an offset that is deep down the list (e.g. offset 1000). You can use the scrollTo method of the underlying ref (this.sectionList._wrapperListRef._listRef
) or implement getItemLayout and use scrollToLocation*Expected Behavior
On Android it should scroll until the desired position, just like on iOS.
Actual Behavior
-> On iOS it is working, on Android it will only scroll until the 10th item, because only 10 items are rendered initally
Workaround: Setting
initialNumToRender
to 1000 will work, but this might crash on low end devices.Reproducible Demo
Please check out this CRNA sample to reproduce the bug:
https://github.com/peterjuras/rn-list-scrollTo-bug
The text was updated successfully, but these errors were encountered: