     private var isClanchTop:Bool = false
     private var isClanchBottom:Bool = false
     
+    private var dateWidth: CGFloat = 0
     
     private var messageState = ACMessageState.UNKNOWN().ordinal()
     private var cellLayout: TextCellLayout!

        // Always update bubble insets
        if (isOut) {
            bindBubbleType(.TextOut, isCompact: isClanchBottom)
            // dateText.textColor = appStyle.chatTextDateOutColor
            
            bubbleInsets = UIEdgeInsets(
                top: (isClanchTop ? AABubbleCell.bubbleTopCompact : AABubbleCell.bubbleTop),

            attrDate.yy_font = AABubbleTextCell.dateFont
            attrDate.yy_color = ActorSDK.sharedActor().style.chatTextDateOutColor
            dateLayout = YYTextLayout(containerSize: CGSizeMake(timeWidth, CGFloat.max), text: attrDate)
            dateWidth = dateLayout?.textBoundingSize.width
        } else {
            let attrDate = NSMutableAttributedString(string: AACellLayout.formatDate(date))
            attrDate.yy_font = AABubbleTextCell.dateFont
            attrDate.yy_color = ActorSDK.sharedActor().style.chatTextDateInColor
            dateLayout = YYTextLayout(containerSize: CGSizeMake(timeWidth, CGFloat.max), text: attrDate)
            dateWidth = dateLayout?.textBoundingSize.width
        }
        
        // Calculating bubble height
