Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Scroll to bottom does not work correctly if the newest message in the conversation is long #480

Closed
ThiemNguyen opened this issue Sep 9, 2014 · 9 comments · Fixed by #644
Labels
Milestone

Comments

@ThiemNguyen
Copy link

Hi,

I've just found another glitch with scroll-to-bottom feature which hasn't seem to be reported yet. Steps to reproduce:

  • Open demo app (it's not necessary to start with an empty conversation).
  • Type in a fairly long lorem ipsum message (around 15-line one in my test case).

Issue:

  • When I send the message, it actually scrolls way down but just around a little bit more than half of the message's height, causing the keyboard to hide the message partially.
  • When I pull to dismiss the keyboard, and manually scroll to bottom, then tap textview to active the keyboard again, similar issue is happened.

Here is the screenshot:
img_0257

The full message:
img_0258

Another point I noticed is that this issue only happens if that long message is the latest one in the conversation. If we add a short message after it, the collection view scrolls correctly.

@ThiemNguyen ThiemNguyen changed the title Scroll to bottom does not working correctly for long messages Scroll to bottom does not working correctly if the newest message in the conversation is long Sep 9, 2014
@jessesquires
Copy link
Owner

Thanks @ThiemNguyen - sounds related to #256

@gblazex
Copy link

gblazex commented Nov 10, 2014

With #256 resolved this could be closed for now as well.

@jessesquires
Copy link
Owner

@galambalazs - can you confirm that this is fixed?

(I think I tested the other day and could still reproduce....)

@gblazex
Copy link

gblazex commented Nov 10, 2014

You are right, I just thought it was the same issue. Still happening.
Let's see if I can track down what's causing this.

@toblerpwn
Copy link
Contributor

This issue appears to be caused by using the wrong scroll position at JSQMessagesViewController.m:368. Using UICollectionViewScrollPositionBottom fixes the problem.

See PR #644

@gblazex
Copy link

gblazex commented Nov 26, 2014

Yes I noticed this too and it's logical. You want it to be bottom aligned (instead of sending the last message to the top, because for long messages it means the bottom part will be cut off).

The only problem is that this doesn't leave a nice margin below the last cell.

If we could crack that we are golden.

@toblerpwn
Copy link
Contributor

My PR #644 addresses both cases as best we can: small cells get 'Top' scroll position, and large cells get 'Bottom'. It is slightly imperfect for large cell bottom padding (for the issues you mention) but certainly an improvement.

@gblazex
Copy link

gblazex commented Nov 26, 2014

Yes maybe it could be added as a temporary fix

(although when those two words bond together time seems to fade away... :-)

@toblerpwn
Copy link
Contributor

Agreed; it is better than what is in field for handling huge cells, but still imperfect due to (probably) UIKit native margin handling. Will make note stating the same in the PR.

@jessesquires jessesquires changed the title Scroll to bottom does not working correctly if the newest message in the conversation is long Scroll to bottom does not work correctly if the newest message in the conversation is long Dec 19, 2014
@jessesquires jessesquires added this to the Release 6.1.1 milestone Dec 19, 2014
jessesquires added a commit that referenced this issue Dec 19, 2014
fix #480: scrollToBottomAnimated: fix long message handling
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants