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

[Android][SectionList/FlatList] scrollTo not working because offset is outside rendered "canvas" #16676

Closed
peterjuras opened this issue Nov 4, 2017 · 5 comments
Labels
Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@peterjuras
Copy link
Contributor

Is this a bug report?

Yes
Have you read the Contributing Guidelines?

Yes
Environment

react-native -v: 0.46.4
node -v: 8.1.4
npm -v: 5.3.0
yarn --version: 0.27.5

Then, specify:

Target Platform: Android

Development Operating System: macOS

Build tools: irrelevant for bug

Steps to Reproduce

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.
Reproducible Demo

Please check out this CRNA sample to reproduce the bug:
https://github.com/peterjuras/rn-list-scrollTo-bug

@peterjuras
Copy link
Contributor Author

Reopend because #15695 was closed without response.

@bolan9999
Copy link

FlatList and SectionList is bad performance. Try this,please. may be it is a surprise for you

https://github.com/bolan9999/react-native-largelist

@juliusspencer
Copy link

Having the same issue…

@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?

I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.

How to ContributeWhat to Expect from Maintainers

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon. labels Feb 24, 2018
@juliusspencer
Copy link

juliusspencer commented Feb 24, 2018

I'm running:
"react-native": "^0.53.3",

Also this auto closing is terrible for the platform.

@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

4 participants