FredrikOseberg / react-chatbot-kit

MIT License
299 stars 139 forks source link

How to avoid automatic scrollToView() #75

Closed alanmrochadeveloper closed 2 years ago

alanmrochadeveloper commented 2 years ago

I got a form with many fields in the bot chat message display within a widget, but when I change any value from any field it does trigger scrollToView() automatically as a default behavior causing my view to go to the bottom of the form when I'm at top writing something! Is there any way to avoid it from happening?

ysong10 commented 2 years ago

hello, I also met some problem related to scrollToView(), I think the reason is that when you change any value in some chat message, the messages state is changed, so useEffect is called, then the scrollToView is called which causes your view to the bottom.

I have solved my problem, I put my solution in the comment of issue #76. Maybe you can check it to see if it is gonna help you.

alanmrochadeveloper commented 2 years ago

Thank you, gonna try it later, then I will bring the feedback.

FredrikOseberg commented 2 years ago

Fixed in 2.0.0. Chatbot now takes a disableScrollToBottom flag.