mirror of
https://github.com/MessageKit/MessageKit.git
synced 2026-02-06 19:03:19 +00:00
Merge branch 'development' of https://github.com/hyouuu/MessageKit into development
This commit is contained in:
@@ -45,9 +45,15 @@ internal extension MessagesViewController {
|
||||
|
||||
@objc
|
||||
private func handleTextViewDidBeginEditing(_ notification: Notification) {
|
||||
if scrollsToBottomOnKeyboardBeginsEditing {
|
||||
guard let inputTextView = notification.object as? InputTextView, inputTextView === messageInputBar.inputTextView else { return }
|
||||
messagesCollectionView.scrollToBottom(animated: true)
|
||||
if scrollsToLastItemOnKeyboardBeginsEditing || scrollsToBottomOnKeyboardBeginsEditing {
|
||||
guard let inputTextView = notification.object as? InputTextView,
|
||||
inputTextView === messageInputBar.inputTextView else { return }
|
||||
|
||||
if scrollsToLastItemOnKeyboardBeginsEditing {
|
||||
messagesCollectionView.scrollToLastItem()
|
||||
} else {
|
||||
messagesCollectionView.scrollToBottom(animated: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,10 +36,18 @@ UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
|
||||
/// The `InputBarAccessoryView` used as the `inputAccessoryView` in the view controller.
|
||||
open lazy var messageInputBar = InputBarAccessoryView()
|
||||
|
||||
/// A Boolean value that determines whether the `MessagesCollectionView` scrolls to the
|
||||
/// last item whenever the `InputTextView` begins editing.
|
||||
///
|
||||
/// The default value of this property is `false`.
|
||||
/// NOTE: This calls scrollToLastItem where as the below flag calls scrollToBottome - check methods for differences
|
||||
open var scrollsToLastItemOnKeyboardBeginsEditing: Bool = false
|
||||
|
||||
/// A Boolean value that determines whether the `MessagesCollectionView` scrolls to the
|
||||
/// bottom whenever the `InputTextView` begins editing.
|
||||
///
|
||||
/// The default value of this property is `false`.
|
||||
/// NOTE: This calls scrollToBottome where as the above flag calls scrollToLastItem - check methods for differences
|
||||
open var scrollsToBottomOnKeyboardBeginsEditing: Bool = false
|
||||
|
||||
/// A Boolean value that determines whether the `MessagesCollectionView`
|
||||
|
||||
Reference in New Issue
Block a user