Fix scrollToBottom && remove scrollsToBottomOnFirstLayout#395
Fix scrollToBottom && remove scrollsToBottomOnFirstLayout#395SD10 merged 6 commits intoMessageKit:developmentfrom
Conversation
| scrollToItem(at: indexPath, at: .bottom, animated: animated) | ||
|
|
||
| let collectionViewContentHeight = collectionViewLayout.collectionViewContentSize.height | ||
| let isContentTooSmall = (collectionViewContentHeight < bounds.height * 2) |
There was a problem hiding this comment.
The reason is scrollToItem would sometimes invalid when collectionViewContentSize's height slightly larger than collectionView's height.
There was a problem hiding this comment.
Yes, I understand that, but why did we decide to use * 2? Is this just a random number?
There was a problem hiding this comment.
Nope, it's based on my tests, I found scrollToItem sometimes invalid when last cell's maxY greater than bounds's height but less than 2 * bounds's height.
|
@zhongwuzw This looks good. I fixed the problem with the The only thing I notice about this change is there is a small flicker from using batch updates 🤔 |
|
@zhongwuzw I also want to mention you don't have to work from a fork of the project, you're a contributor so you can work from branches on the main MessageKit repo 😅 |
|
SD10
left a comment
There was a problem hiding this comment.
@zhongwuzw Can you add a CHANGELOG entry under Removed for the scrollsToBottomOnFirstLayout flag? And another under Fixed for scrollToBottom()?
|
@SD10 , I added the changelog. |
No description provided.