Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

How to stop scrolling when prepending items to ion list

$
0
0

Within my app I have a chat box. Messages are lined up from the bottom and I use an ion-infinite-scroll at the top to detect when scrolling up. When scrolling up I get previous messages from the database. This works well. However, my main issue has been getting the scroll to remain in the same position, i.e. over the same messages, when messages are prepended to the top of the list.

I have tried two solutions. One using scroll events and the other using ngAfterViewChecked. These detect changes in the scroll element height ( got via getScrollElement( ) ) from ion content. And then adding the change in scroll height to the scroll position.This works, but makes for a very jumpy experience as the position update is delayed for a few milliseconds.

I was hoping somebody may have solved this previously and could help guide me in solving this?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>