-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
scrollToIndex and scrollToLocation not working on FlatList, SectionList #1854
Comments
Same issue with electron : My dependencies : "react-native-web": "^0.14.11",
"electron": "^6.0.12",
"expo": "^40.0.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-native": "^0.63.4", |
A work around I did is to define the function Example on expo: https://snack.expo.io/@gusgard/react-native-swiper-flatlist |
For some reason adding a delay of even 1 ms to the I.e. //...
setTimeout(()=>{
flatListRef.current.scrollToIndex({index: 0});
}, 1);
//... |
add height to the container should fix the problem |
In my case, (horizontal flatlist on web), I needed to add width for Flatlist component, it worked even without getItemLayout
|
Here, you can see that, without a height set, the scroll is completely broken in the web implementation. The list doesn't shrink to what is actually shown, and other batches of items don't load. |
Thank you so much it works for me |
thanks, it works to me |
Hi, to solve this issue, I've:
For example, using a getItemLayout={(data, index) => ({
length: 350,
offset: 350 * index,
index,
})} In my code, there's no need to use I've used |
scrollToIndex and scrollToLocation not working on FlatList, SectionList
Sample code: (url) https://snack.expo.io/I9cYUYxJi
Environment (include versions). Did this work in previous versions?
The text was updated successfully, but these errors were encountered: