Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix scroll to last item to take section inset into account#1832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
hidoon wants to merge10 commits intoMessageKit:main
base:main
Choose a base branch
Loading
fromhidoon:main

Conversation

@hidoon
Copy link

What does this implement/fix? Explain your changes.

This correction addresses the bug (issue#1830) wherescrollToLastItem(at:animated:) didn't perform as expected. Previously, it would scroll to the last item without considering thesectionInset, eliminating the gap between the last cell andinputBarAccessoryView.

Does this close any currently open issues?

Yes it does, (issue#1830 )

Where has this been tested?

Devices/Simulators:

  • IOS Simulator iPhone 15 Pro Max / iOS 17.0.1
  • Physical Device iPhone 13 / iOS 17.2.1
    iOS Version:
  • IOS Simulator iPhone 15 Pro Max / iOS 17.0.1
  • Physical Device iPhone 13 / iOS 17.2.1
    Swift Version:
  • Swift 5.9
    MessageKit Version:
  • 4.2.0

Copy link
Member

@KaspikKaspik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Do you have a video with the fix implemented?

@luoshuaiqing
Copy link

luoshuaiqing commentedMar 10, 2024
edited
Loading

Hi@hidoon ! It looks like this issue did not fully still not solved. For example, in theExample code's Advanced VC, after entering the advanced vc, it is also not scrolling correctly to the bottom. Would you mind helping take a look what is wrong? Thank you so much! (I was using a similar approach in the example code for my own project, and have spent 10+ hrs already but still couldn't solve the issue myself 😢 )

Update - It seems like the issue happens when the custom input bar's height is larger than the default input bar's

Screenshot 2024-03-10 at 12 12 36 PM

@luoshuaiqing
Copy link

Another issue I found is: if I created a custom footer view for the messages collection view, scroll to bottom has a large and very noticeable padding at the bottom, and seems to be the exactly one footer cell's height.

@hidoon
Copy link
Author

hi@luoshuaiqing, as far as I know, themessagesCollectionView is not related toinputBarAccessoryView, if you are talking about scrolling down. I don't know what to do to make pull request accepted and merged, but if you can, you can try to use my pull request to see if it fixes your issue. Btw, is the footer view you are talking aboutinputBarAccessoryView?

@luoshuaiqing
Copy link

hi@luoshuaiqing, as far as I know, the messagesCollectionView is not related to inputBarAccessoryView, if you are talking about scrolling down.

Oh I am not talking about scrolling down. I am talking aboutscrollToBottom() implementation in MessageKit is not correctly scrolling to bottom with custom input bar. (aka when I setmessageInputBar = MyCustomView() andinputBarType = .custom(MyCustomView(). The fix in this PR didn't solve this issue unfortunately 😢

Btw, is the footer view you are talking about inputBarAccessoryView?

I am referring tomessagesCollectionView.dequeueReusableFooterView(MyCustomFooterView.self, for: indexPath)

@hidoon
Copy link
Author

@luoshuaiqing Oh, I see. I think the problem you face is the height of your custom view is not taken into account andmessagesCollectionView stays behind your custom view. Idk if there is a data source or delegate function to specify the height of your custom view, but if there is not, maybe you can set a specificcontentInset tomessagesCollectionView. That's a hacky way but it may work.

@luoshuaiqing
Copy link

Thanks for the advice, but it looks like it didn't work after I do something likemessagesCollectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: messageInputBar.frame.height, right: 0), and also I don't think there is a delegate method for accessory view size calculator

@hidoon
Copy link
Author

heyluoshuaiqing and other who needs help, there is a function inInputBarAccessoryViewDelegate, which is delegate ofmessageInputBar,func inputBar(_ inputBar: InputBarAccessoryView, didChangeIntrinsicContentTo size: CGSize) gives new size.

@Kaspik
Copy link
Member

Is this ready to be merged given the conversation here?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I dont think 3 times called scroll function is better

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@KaspikKaspikKaspik approved these changes

+2 more reviewers

@fukemyfukemyfukemy left review comments

@KmuzzamkhanKmuzzamkhanKmuzzamkhan approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@hidoon@luoshuaiqing@Kaspik@fukemy@Kmuzzamkhan

[8]ページ先頭

©2009-2025 Movatter.jp