React-custom-scrollbars: Scroll to bottom (Always)

Created on 18 Sep 2017  路  2Comments  路  Source: malte-wessel/react-custom-scrollbars

Thanks for the best component !!!

I created a chat room, for my chat I need to be scrolled always down (default),
how can I achieve this ?

Most helpful comment

Use the method scrollToBottom?

Get the instance first <Scrollbars ref={c => { this.scrollComponent = c }}> and then on every time the message is added call the function scrollToBottom, best in setTimeout(..., 0) to be sure it is called after render has completed. Or call it in componentDidUpdate and detect that number of messages have changed.

All 2 comments

Use the method scrollToBottom?

Get the instance first <Scrollbars ref={c => { this.scrollComponent = c }}> and then on every time the message is added call the function scrollToBottom, best in setTimeout(..., 0) to be sure it is called after render has completed. Or call it in componentDidUpdate and detect that number of messages have changed.

Yeah it work good!!!
thank you ...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Niryo picture Niryo  路  3Comments

philcockfield picture philcockfield  路  3Comments

bunkat picture bunkat  路  5Comments

Amdingo picture Amdingo  路  4Comments

hank7444 picture hank7444  路  5Comments