Detaysoft / react-chat-elements

Reactjs chat elements chat UI, react chat components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: How to scroll to specific message?

cesarve77 opened this issue · comments

I want to know this too

I want to know this too

Hi, you can use focus property in message model, pls don't forget add onMessageFocused function on MessageList component.

  state = {
    messageList: [...]
  }
  
  .
  .
  .

  focusMessage(index) {
    this.state.messageList[index].focus = true;
    this.setState(this.state);
  }

  .
  .
  .

  <MessageList
      onMessageFocused={(x) => console.log(x)}
      dataSource={this.state.messageList}
  />

quick question, can this work with react function hooks? or do I HAVE to use classes?