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

firstItem doesn't work as expected #107

Closed
gvenk opened this issue Aug 4, 2017 · 5 comments
Closed

firstItem doesn't work as expected #107

gvenk opened this issue Aug 4, 2017 · 5 comments

Comments

@gvenk
Copy link

gvenk commented Aug 4, 2017

I'm using the flatlist branch and it looks like the firstItem isn't working. If I set it to something different than 0, the list is displayed on the correct position, but the item isn't rendered. If I start scrolling the list, it appears.

This doesn't happen on the iOS emulator, only on a real device.

For the rest everything is working just fine! Great work on the FlatList implementation!

@gvenk
Copy link
Author

gvenk commented Aug 4, 2017

It appears to be rather random, sometimes this will happen and sometimes not. Like it's some kind of timing issue?

@bd-arc
Copy link
Contributor

bd-arc commented Aug 4, 2017

Hi @gvenk,

I'm afraid that this is a bug of the FlatList component itself. See issues #1831, #13202 and #13316.

One thing that could help is adding removeClippedSubviews={false} to the <Carousel />. Unfortunately, it might take a toll on performance...

You can also try playing with the following props from VirtualizedList and FlatList's docs: initialNumToRender, maxToRenderPerBatch, windowSize and updateCellsBatchingPeriod.

Let me know if any of this tips helped regarding the issue!

@gvenk
Copy link
Author

gvenk commented Aug 7, 2017

Thanks for the info. Unfortunately all the tips from the mentioned issues didn't result in a completely working list.
I tricked the list by setting the firstItem to the actual firstitem - 1 and then use snapToItem() to scroll to the correct item. I did this in componentDidMount() but I had to use a timeout of 250msec otherwise it's not working.
Not a solution I'm totally happy with, but for now it's working.

@bd-arc
Copy link
Contributor

bd-arc commented Aug 7, 2017

@gvenk That's the unfortunate tradeoff of migrating to FlatList: some issues are not resolved yet. You idea is indeed a hack, but it seems like the only solution at the moment.

Note that the 250 ms timeout might be linked to the new prop apparitionDelay (its default value being... 250 ms). You can change it to suit your needs.

@gvenk
Copy link
Author

gvenk commented Aug 7, 2017

Yes, I'll experiment a bit with apparitionDelay, but for now it's working good enough I think.

Thanks!

@gvenk gvenk closed this as completed Aug 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants