diff --git a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.h b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.h index b1c5fb4e7..a50cd464a 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.h +++ b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.h @@ -55,6 +55,7 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Voice Memo +- (void)ensureTextViewHeight; - (void)showVoiceMemoUI; - (void)hideVoiceMemoUI:(BOOL)animated; diff --git a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m index 24ea27888..8a6ea6653 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m @@ -194,6 +194,11 @@ const CGFloat kMaxTextViewHeight = 98; self.inputTextView.text = value; [self ensureShouldShowVoiceMemoButtonAnimated:isAnimated]; + [self ensureTextViewHeight]; +} + +- (void)ensureTextViewHeight +{ [self updateHeightWithTextView:self.inputTextView]; } diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index fdf47e077..4611c501e 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -1209,6 +1209,18 @@ typedef enum : NSUInteger { self.isUserScrolling = NO; } +- (void)viewDidLayoutSubviews +{ + [super viewDidLayoutSubviews]; + + // We resize the inputToolbar whenever it's text is modified, including when setting saved draft-text. + // However it's possible this draft-text is set before the inputToolbar (an inputAccessoryView) is mounted + // in the view hierarchy. Since it's not in the view hierarchy, it hasn't been laid out and has no width, + // which is used to determine height. + // So here we unsure the proper height once we know everything's been layed out. + [self.inputToolbar ensureTextViewHeight]; +} + #pragma mark - Initiliazers - (void)updateNavigationTitle