Skip to content

When keyboard appears setContentOffset is not being called #1867

@cmacera

Description

@cmacera

Describe the bug
I have updated to 4.3.0 from 3.8.0, and I have noticed, that when text input begins editing/keyboard is displayed, the content of the collection view does not change in 4.3 compared to what happened in 3.8. In 3.8 the collection view content offset is updated to keep the offset when keyboard appears. I have tested it in the examples, and it is also reproducible, here a video link that explains better.

With the update, maintainPositionOnKeyboardFrameChanged has been renamed to maintainPositionOnInputBarHeightChanged, but I assume that is for same purpose.

In 3.8 with maintainPositionOnKeyboardFrameChanged enabled, I can see in the library that messagesCollectionView.setContentOffset is called when handleKeyboardDidChangeState,
while in 4.3 with maintainPositionOnInputBarHeightChanged I can not find any call to messagesCollectionView.setContentOffset.

There is an opened feature requestt, but I think this is a bug introduced in 4.0 version.

To Reproduce
Steps/code to reproduce the behavior:
Preconditions: I have disabled messages socket to avoid other scrolls during testing and scrollsToLastItemOnKeyboardBeginsEditing is disabled to be same configuration than my project.

  1. Run the example app
  2. Open "Basic Example"
  3. Tap on input text bar

Expected behavior
A clear and concise description of what you expected to happen.
MessagesCollectionView offset should be updated to include keyboard height and maintain position
Screenshots
If applicable, add screenshots to help explain your problem.
Link to video

Environment

  • What version of MessageKit are you using? Comparing 3.8 vs 4.3
  • What version of iOS are you running on? iOS 18
  • What version of Swift are you running on? Swift 5.1
  • What device(s) are you testing on? Are these simulators? iPhone 15 real device, iPhone 16 Plus and iPhone 16 Pro Max simulators.
  • Is the issue you're experiencing reproducible in the example app? Yes, you can check the video.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions