Emulating any chat messenger ever...how to determine if scroll is at the very bottom of content?

Hey everyone,

I’ve been struggling with this issue for months now and since it’s one of the last things I need to fix before my app goes live, all I’m trying to do is check if the <ion-content>'s scroll is at the very bottom of the content.

You’d think this would be straight forward, but the problem is that when I’m trying to do something like:

  let dimensions = this.content.getContentDimensions();
  let scrollHeight = dimensions.scrollHeight;
  let scrollTop = dimensions.scrollTop;
  let difference = scrollHeight - scrollTop;
  if(difference === 0) {
       this.content.scrollToBottom(300);
  }

The only problem here is that difference is always some random number between 600 - 700, depending on the head of the view. I can’t seem to get it consistent and I have no idea where the 600-700 number is coming from. I’ve tried removing all content from my view so that only the <ion-content> is there just to see if hidden pieces aren’t there, but nothing.

Does anyone know what I’m doing wrong here?