@@ -63,6 +63,8 @@ @interface JSQMessagesViewController () <JSQMessagesInputToolbarDelegate,
6363
6464@property (weak , nonatomic ) UIGestureRecognizer *currentInteractivePopGestureRecognizer;
6565
66+ @property (assign , nonatomic ) BOOL textViewWasFirstResponderDuringInteractivePop;
67+
6668- (void )jsq_configureMessagesViewController ;
6769
6870- (NSString *)jsq_currentlyComposedMessageText ;
@@ -260,13 +262,13 @@ - (void)viewDidAppear:(BOOL)animated
260262- (void )viewWillDisappear : (BOOL )animated
261263{
262264 [super viewWillDisappear: animated];
263- [self jsq_addActionToInteractivePopGestureRecognizer: NO ];
264265 self.collectionView .collectionViewLayout .springinessEnabled = NO ;
265266}
266267
267268- (void )viewDidDisappear : (BOOL )animated
268269{
269270 [super viewDidDisappear: animated];
271+ [self jsq_addActionToInteractivePopGestureRecognizer: NO ];
270272 [self jsq_removeObservers ];
271273 [self .keyboardController endListeningForKeyboard ];
272274}
@@ -844,6 +846,8 @@ - (void)jsq_handleInteractivePopGestureRecognizer:(UIGestureRecognizer *)gesture
844846 [self .snapshotView removeFromSuperview ];
845847 }
846848
849+ self.textViewWasFirstResponderDuringInteractivePop = [self .inputToolbar.contentView.textView isFirstResponder ];
850+
847851 [self .keyboardController endListeningForKeyboard ];
848852
849853 if ([UIDevice jsq_isCurrentDeviceBeforeiOS8 ]) {
@@ -865,6 +869,9 @@ - (void)jsq_handleInteractivePopGestureRecognizer:(UIGestureRecognizer *)gesture
865869 case UIGestureRecognizerStateEnded:
866870 case UIGestureRecognizerStateFailed:
867871 [self .keyboardController beginListeningForKeyboard ];
872+ if (self.textViewWasFirstResponderDuringInteractivePop ) {
873+ [self .inputToolbar.contentView.textView becomeFirstResponder ];
874+ }
868875
869876 if ([UIDevice jsq_isCurrentDeviceBeforeiOS8 ]) {
870877 [self .snapshotView removeFromSuperview ];
0 commit comments