recyclerlistview icon indicating copy to clipboard operation
recyclerlistview copied to clipboard

initialRenderIndex makes content jump around when non deterministic

Open tafelito opened this issue 7 years ago • 8 comments
trafficstars

When using initialRenderIndex or initialOffset to scroll to the bottom on initial render, using forceNonDeterministicRendering makes content to re accommodate and jump around if the provided estimated height is not close to the final height. This does not happen when not using either initial index or offset. Sometimes its not possible to know the height beforehand or even an estimated value, like in a chat app.

How would you prevent this?

tafelito avatar Aug 27 '18 23:08 tafelito

Unfortunately, this feature won't work perfectly in non deterministic scenario. The reason is it will become important to skip multiple frames to allow layout to settle down because of async measure. If it's too important you can hide the ListView to 2-3 frames and then call scrollTo again. In future we'll see how we can deal with this. There is a parallel JS scrollview project that we are working on which can potentially fix this.

naqvitalha avatar Sep 14 '18 09:09 naqvitalha

@naqvitalha what do u mean by waiting and then call scrollTo again? You mean not use the initialRenderIndex?

Is the other project you are working going to be part of RLV? Can we see a sneak peek anywhere?

tafelito avatar Oct 12 '18 18:10 tafelito

Hi @tafelito I see you are working on a chat app. Did you find any good solution for a displaying a large list of chat ?

saadqbal avatar Jul 28 '19 17:07 saadqbal

Hi @tafelito , did you got any solution for this. Is there solution for this @naqvitalha

tragicmj avatar Nov 27 '21 11:11 tragicmj

To all facing this issue, I added layout provider and added accurate dimensions there. It started working normally after that.

I would suggest defining fixed height for the list item and building UI with that.

@tragicmj @saadqbal @tafelito

prayaslashkari avatar Jan 12 '22 19:01 prayaslashkari

@naqvitalha any update on this ?

siddharth-kt avatar Jul 22 '22 11:07 siddharth-kt

@callmemonky in case of having chat, I don't think we can add accurate dimensions, as a text can be as short as two lines or as long as 10 lines

tragicmj avatar Aug 16 '22 09:08 tragicmj