Hi, I am developing a chat app, and I would like to be able to open the chat component already scrolled at the bottom.
I am currently using to this.content.scrollToBottom(0)
on the ionViewDidEnter()
function, but that renders the page scrolled at the top first, and then scrolls down. I have already tried to put the scrollToBottom at the ionViewWillEnter()
but that doesn’t work, I guess it’s because the page is not rendered yet.
The chat page is being opened with this.navCtrl.push(ConversaPage, {some:'parms'})
when the user clicks on the chat list item.
The messages are a <div *ngOf="let msg of msgs">
.
I have already tried to user the angular2-auto-scroll directive, putting it at the ion content, but it didn’t scroll the content…
Could you help me with that? The gif below shows how it is working now, it first opens the page on the top, then scrolls down. It would be great if there was a way to already open at the bottom.
Can’t update everything because a lot of styles have changed, just sending the version info in case it could help with anything.
Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.1
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.36
ios-deploy version: 1.9.0
ios-sim version: 5.0.8
OS: macOS Sierra
Node Version: v4.6.0
Xcode version: Xcode 7.3.1 Build version 7D1014