LucasBassetti / react-simple-chatbot

:speech_balloon: Easy way to create conversation chats
https://lucasbassetti.com.br/react-simple-chatbot/
MIT License
1.74k stars 602 forks source link

How can I manipulate the auto-scroll feature #211

Open Kashio opened 5 years ago

Kashio commented 5 years ago

If a user action is triggering a few steps one after another, the chatbot scrolls all the way to the bottom. I want it to scroll to the first message added as a response to the user action instead, how can this be achieved?

pascalgagneur commented 5 years ago

Is not possible. The chatbot code always scrolls to the last inserted step (DOMNode) https://github.com/LucasBassetti/react-simple-chatbot/blob/master/lib/ChatBot.jsx#L118 and https://github.com/LucasBassetti/react-simple-chatbot/blob/master/lib/ChatBot.jsx#L169

Not what you want but you could use a custom component to have multiple rows.

const steps = [
  {
    id: '1',
    component: <span>Multiple<br /> row <br /> with <br /> custom <br /> component </span>,
    asMessage: true,
    delay: 2000,
    end: true
  }
];

image