Infinite scroll upward direction ionic 3

How can I use infinite scroll to load more data in reverse direction? I want to load data on scroll up instead of scroll bottom. I’m developing chatting app so i need chat style upward infinite scrolling. thanks,

what do you mean?you mean to say that if msg is send then it should go to upward direction.is it right or not?

thanks you reply:
I want when I open chat window, it will loading last message and then when I scroll top, it will appear message old.

  • the same: WhatsApp, zalo, message

I done by “infinite scroll”
html:
<ion-infinite-scroll (ionInfinite)="$event.waitFor(doInfinite())" threshold=“10px” position=“top”>


-> app.ts [provider]

getMess(id1, id2, numberLimit) {
var user = this.db.collection(‘chats’).doc(this.util.getChatId(id1, id2)).collection(‘chats’);
var firstMess = user.ref
.orderBy(‘date’)
.limit(numberLimit)
return firstMess.get();
}
-> chats.ts

doInfinite(): Promise {
return new Promise((resolve) => {
console.log(resolve);
setTimeout(() => {
var userNext = 10;
this.limitMess += userNext;
this.appProvider.getMess(this.user[‘base64’], this.receiver[‘base64’], this.limitMess).then(x => {
var next = this.db.collection(‘chats’).doc(this.util.getChatId(this.user[‘base64’], this.receiver[‘base64’])).collection(‘chats’).ref
.orderBy(‘date’)
.startAfter(this.lastVisible)
.limit(userNext);
next.get().then(a => {
a.forEach(b => {
this.msgList.push(b.data());
console.log(b.data());
})
})
this.lastVisible = x.docs[x.docs.length - 1];
})
resolve();
}, 500);
})
}
and
ionViewWillEnter() {

this.itemsCollection = this.db.collection<any>('chats');
this.itemsCollection.doc(this.util.getChatId(this.user['base64'], this.receiver['base64'])).collection("chats", 
ref => ref.orderBy('date')).snapshotChanges().subscribe(data => {
  this.msgList = [];
  data.forEach(doc => {
    var chat = doc.payload.doc.data();
    chat['id'] = doc.payload.doc.id;
    this.msgList.push(chat);
  })
})

=> can’t show last message and loading message old orderby(time). can you help me.
Thanks