Home > Net >  Navigation goBack() can go to exact height of Flatlist of previous screen?
Navigation goBack() can go to exact height of Flatlist of previous screen?

Time:07-19

I use react native.

And when I navigation.goBack() to previous screen, can I go to exact height of previous screen?

In detail, I use Flatlist in previous screen,

so let's say, if I have 1 -> 2 -> 3 screen feed, I scrolled down to 3.

I go another screen then go back from next screen, screen goes to top, which is 1.

can i go to 3 screen's height again?

CodePudding user response:

I am not sure if this is the best answer, but flatlist has scrollToIndex property, that accept index of item you want to scroll. The problem is that you would have to save that index somewhere, like redux. If you want to do this to one or two flatlist it's okay, but if you have multiple of them, it isn't the best answer.

  • Related