@gaweleczek wrote:
Hi,
I’m building a chat app and I want to make sure that the user always sees the bottom of the list of messages.
<IonContent ref={this.messagesRef}>
and then I call this function from a few places
scrollToBottom = () => { if (!this.messagesRef || !this.messagesRef.current) return; //window.scrollTo(0, this.messagesRef.current.offsetTop) this.messagesRef.current.scrollToBottom(); //scrollIntoView({ behavior: "smooth" }); console.log("ScrollToTheBottom"); }
But when I do this I get the following error:
TypeError: this.messagesRef.current.scrollToBottom is not a function
What am I doing wrong here?
Thanks!
Posts: 1
Participants: 1