I have a div where I would like to always scroll down.
scrollDown(){
var chatt = this.conversa;
this.conversa.scrollTop = chatt.scrollHeight;
}
verificKeyPress(e){
if (e.key == "Enter") {
this.scrollDown();
...
}
}
<div id="scroll" ref={(conversa) => this.conversa = conversa} style={{display: "block",overflowY: "auto", overflowX: "hidden", position: "absolute", ...}}>
...
</div>
In this link is a giphy showing the error that is giving. Attention in the sequence entered and where it appears: https://media.giphy.com/media/LUeVZl33p6WlQrVmq9/giphy.gif. Thank you!
Note: In the function verifyKeyPress has more thing to work sending the message, but I did not put it because it is extensive
I got it, the problem is that this function (this.scrollDown) should be in the callback of another function that I did not show here, I apologize, it would be difficult for someone to help me, I have little experience, but anyway thank you.