Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flatlist ScrollToEnd does not work as expected

How is it possible to to scroll to the bottom of a flatlist when the data is fully loaded.

i thought it should be possible by calling

this._flatList.scrollToEnd() in the componentDidMount function. This doesn work for me.

If i use that code for a button, then it works.

Then i thought that the onLayout={() => { console.log("onLayout"); this._flatList.scrollToEnd()} } could help. but also this doesnt.

like image 532
user2952129 Avatar asked Mar 06 '26 07:03

user2952129


1 Answers

You can use with timer

componentDidMount() {
  setTimeout(() => {
    this._flatList.scrollToEnd();
  }, 200);
}
like image 191
SiSa Avatar answered Mar 08 '26 22:03

SiSa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!