         }
         isTypingIndicatorViewHidden = isHidden
 
-        let ctx = UICollectionViewFlowLayoutInvalidationContext()
-        ctx.invalidateSupplementaryElements(
-            ofKind: MessagesCollectionView.elementKindTypingIndicator,
-            at: [indexPathForTypingIndicatorView()]
-        )
-
         if animated {
             messagesCollectionView.performBatchUpdates({ [weak self] in
-                self?.invalidateLayout(with: ctx)
+                self?.invalidateLayoutForTypingIndicatorChange()
                 updates?()
             }, completion: completion)
         } else {
-            invalidateLayout(with: ctx)
+            invalidateLayoutForTypingIndicatorChange()
             updates?()
             completion?(true)
         }
-    }
-
-    private func adjustBottomInsetForTypingIndicatorView() {
-        guard let delegate = messagesCollectionView.messagesLayoutDelegate else { return }
-        let height = delegate.typingIndicatorViewSize(in: messagesCollectionView).height
-        let inset = delegate.typingIndicatorViewTopInset(in: messagesCollectionView)
-        let totalHeight = height + inset
-        let delta = isTypingIndicatorViewHidden ? -totalHeight : totalHeight
-        messagesCollectionView.contentInset.bottom += delta
     }
 
     // MARK: - Attributes

    private func indexPathForTypingIndicatorView() -> IndexPath {
        let section = messagesCollectionView.numberOfSections - 2
        return IndexPath(item: 0, section: max(section, 0))
    }

    // MARK: - Layout Invalidation

/// The layout object used by `MessagesCollectionView` to determine the size of all
/// framework provided `MessageCollectionViewCell` subclasses.
open class MessagesCollectionViewFlowLayout: UICollectionViewFlowLayout {

    /// There is a known issue where the layout invalidation
    /// causes a fatal crash when setting the typing indicator
    /// view to hidden. The cause has been isolated to
    /// `UICollectionViewFlowLayoutInvalidationContext` which
    /// causes an `IndexPath` with 0 indices to be passed into
    /// `layoutAttributesForSupplementaryView` when accessing
    /// `.section`. The current work around is to not use
    /// `invalidateLayout(with: context)` for the case of
    /// setting the typing indicator to hidden but rather
    /// `invalidateLayout()`. This however is not efficent
    /// and thus will not be the default behaviour. Instead,
    /// if you experience the crash set this value to TRUE.
    ///
    /// The default value is FALSE
    public var invalidateLayoutOnTypingIndicatorHidden: Bool = false

    open override class var layoutAttributesClass: AnyClass {
        return MessagesCollectionViewLayoutAttributes.self
