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

Re-Render takes some time #17

Open
xempie opened this issue Dec 15, 2017 · 11 comments
Open

Re-Render takes some time #17

xempie opened this issue Dec 15, 2017 · 11 comments

Comments

@xempie
Copy link

xempie commented Dec 15, 2017

I tried this and seems it fixed some of the FlatList issues but I noticed when I scroll back (top or bottom) (specially when I'm using images) it takes some time to re-render and display the blocks.

So it would be good if it has an offeset to pre-load some items before displaying in viewport in order to prevent the blank space between blocks which doen't look good.

Any idea?

@cjcheshire
Copy link

I'm also experiencing this. It can take a few seconds once it's scrolled to the top to render the items.

@st0ffern
Copy link
Owner

is it after refresh or if you scroll fast?

@cjcheshire
Copy link

Only tested this on iOS so far by tapping the status bar clock to return to the top of the list.

@thame
Copy link

thame commented Feb 4, 2018

I noted the same issue on iOS. Interestingly, the React FlatList component wasn't having any performance issues on iOS but was extremely slow on Android. I created a new PlatformFlatList component that serves OptimizedFlatList on Android and it worked great - including on relatively underpowered Android devices that were really struggling.

https://gist.github.com/thame/a7e5c61e7bb3a6d56406db37da090a76

@st0ffern
Copy link
Owner

st0ffern commented Feb 4, 2018

@thame, feel free to create a PR. I think that this solution also should be implemented.

@thame
Copy link

thame commented Feb 4, 2018

@Stoffern Would love to, complete git/React noob so no idea how :)
But, this is an awesome component, thank you!

@st0ffern
Copy link
Owner

st0ffern commented Feb 5, 2018

@xempie is this issue only related to ios or android to?

@thame
Copy link

thame commented Feb 12, 2018

@Stoffern Sorry for the delay, I'm subscribed now. The performance issue I was having was mostly on Android (which is why I preferred the basic FlatList on iOS).

@gonzaloreciog
Copy link

gonzaloreciog commented Mar 10, 2018

Quick and patchy fix for this is to never hide the first items. Make sure to add enough to fill the screen but not much more.

So in our case maximum items is 3, so we will never hide the first 3 items to avoid this 2-3 seconds white screen when scrolling to top.

So the _updateItem() function on OptimizedFlatList.js would look like this:

if (index != 0 && index != 1 && index != 2) {
  if (!this.rowRefs[index].ref) {
    return false;
  }
  this.rowRefs[index].ref.setVisibility(visibility);
  return visibility;
}

So basically: just wrapping the function content within an IF stating which items not to hide.

@udarts
Copy link

udarts commented Mar 29, 2019

This is still happening. Not fixed yet.

@twsuneth
Copy link

Quick and patchy fix for this is to never hide the first items. Make sure to add enough to fill the screen but not much more.

So in our case maximum items is 3, so we will never hide the first 3 items to avoid this 2-3 seconds white screen when scrolling to top.

So the _updateItem() function on OptimizedFlatList.js would look like this:

if (index != 0 && index != 1 && index != 2) {
  if (!this.rowRefs[index].ref) {
    return false;
  }
  this.rowRefs[index].ref.setVisibility(visibility);
  return visibility;
}

So basically: just wrapping the function content within an IF stating which items not to hide.

Thanks...! This solved another issue of not showing the 1st item when data resets (Refresh func).

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

7 participants