Messagekit: self.messagesCollectionView.scrollToBottom() not working on iOS 14

Created on 8 Oct 2020  路  14Comments  路  Source: MessageKit/MessageKit

scrollToBottom works on iOS 14/14.1 not at all (works on iOS 13.5)

  • after input and send a text an extra empty space is added between keyboard and the inputted text (seems that the extra space has the same height as the keyboard height)
  • the bug is reproducible: MessageKit Example-App -> SwiftUI-View

----------------------------------------------

  • What version of MessageKit are you using?

3.4.1

  • What version of Swift are you running on?

target iOS 13 - Swift5
target iOS 14 - Swift5

  • What device(s) are you testing on? Are these simulators?

Problem occur on iPhone11Pro and on Simulator

  • Is the issue you're experiencing reproducible in the example app?

the bug is reproducible: MessageKit Example-App -> SwiftUI-View

  • Video that shows the behavior of the bug:

Message-Kit Example App (SwiftUI-View)

Most helpful comment

problem is still present. i hope this bug will be confirmed soon.

All 14 comments

Will check this, in the meantime you could try scrollToLastItem() :)

@martinpucik Have you checked if it works on our project still?

i just tried scrollToLastItem()

unfortunately scrollToLastItem() behaves in iOS14 like scrollToBottom(). The inputed text is hidden behind the inputArea :/

scrollToLastItem() works on iOS 13.5

scrollToLastItem() was embedded in this function....

if self?.isLastSectionVisible() == true {
}

After commenting these lines out scrollToLastItem() is working but still add additional space between keyboard and inputed text. The additional space has approximately the height of the keyboard. same problem occurs with "scrollToBottom()"

any idea @Kaspik @martinpucik ?

@Kaspik @martinpucik

you can also reproduce the bug on iOS 14 in the "Example-App" -> "SwiftUI Example" (after input some text and send it)

it is strange that the problem occurs in the Example-App only with the SwiftUI Example. On my Project the Controller is not imbedded with SwiftUI

solved it using below code:

        scrollsToBottomOnKeyboardBeginsEditing = true
        scrollsToLastItemOnKeyboardBeginsEditing = true
        maintainPositionOnKeyboardFrameChanged = true

solved it using below code:

        scrollsToBottomOnKeyboardBeginsEditing = true
        scrollsToLastItemOnKeyboardBeginsEditing = true
        maintainPositionOnKeyboardFrameChanged = true

i tried this. unfortunately this fix solves not the problem. In the MessageKit-Example App (Sources->Views->SwiftUI->MessagesView.swift) these two lines already exits:

messagesVC.scrollsToBottomOnKeyboardBeginsEditing = true // default false
messagesVC.maintainPositionOnKeyboardFrameChanged = true // default false

i replaces them with these lines:

messagesVC.scrollsToBottomOnKeyboardBeginsEditing = true // default false
messagesVC.scrollsToLastItemOnKeyboardBeginsEditing = true // default false
messagesVC.maintainPositionOnKeyboardFrameChanged = true // default false

The Example-App is still showing this strange scrolling on iOS14. Check this Video:
Message-Kit Example App (SwiftUI-View)

lets try to comment load more message function, then test by type into textview then press send programmatically bro

lets try to comment load more message function, then test by type into textview then press send programmatically bro

i am not sure if i understood you right.

what should be archived by commenting the "load more message" function? "load more message" should work with MessageKit anyway. After all the Example-App (Sources->Views->SwiftUI->MessagesView.swift) contains no "loadMoreMessages" function.

The MessageKit Example-App is still showing this strange scrolling on iOS14. Check this Video:

Message-Kit Example App (SwiftUI-View)

This problem also exists on iOS14.1 and it also occur if MessageKit is implemented directly (without SwiftUI) and the navigation starts from a SwiftUI-View

This issue has been marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

problem is still present. i hope this bug will be confirmed soon.

@zaaaszaaas could you please check the Example app again on master? I can't repro this issue anymore

@zaaaszaaas could you please check the Example app again on master? I can't repro this issue anymore

@martinpucik

i just tried. with the new update "sending a message" is not working in the "MessageKit Example-App -> SwiftUI-View". tested on iOS 14.2

What happens: after clicking on "send" the inputed text disappears (as it should) and no new message is inserted

Did you tried sending a message in the "MessageKit Example App -> SwiftUI-View"?

So the problem this issue is about is fixed. Problem with SwiftUI persists, but that's different.

We don't fully support SwiftUI, it's still experimental. I'll close this issue as it's fixed then. :)

hi @Kaspik

The MessageKit-Example-App contains a SwiftUI Implementation that does not work anymore. a chat view that scrolls not to the right place is not just a little bug, its a big one.

To say the problem has been resolved under this circumstance, I do not consider it logical.

SwiftUI is now in version 2.0. i don't think you can call it anymore experimental.

I hope the problem will be fixed soon. however if there will be no fix in the future the Swift-UI Implementation from the Example-App should be removed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ChandraPrakashJangid picture ChandraPrakashJangid  路  3Comments

TheDarkCode picture TheDarkCode  路  3Comments

mlequeux picture mlequeux  路  3Comments

asn111 picture asn111  路  3Comments

bilaalrashid picture bilaalrashid  路  3Comments