@@ -309,6 +309,16 @@ - (BOOL)isPresentedInPopover
309309 return _presentedInPopover && UI_IS_IPAD ;
310310}
311311
312+ - (BOOL )isQuickTypeBarVisible
313+ {
314+ CGFloat quickTypeBarHeight = self.keyboardHC .constant -minimumKeyboardHeight ();
315+
316+ if (UI_IS_IOS8_AND_HIGHER && quickTypeBarHeight > 0.0 && self.textView .autocorrectionType != UITextAutocorrectionTypeNo) {
317+ return YES ;
318+ }
319+ return NO ;
320+ }
321+
312322- (SLKTextView *)textView
313323{
314324 return self.textInputbar .textView ;
@@ -532,14 +542,6 @@ - (void)setAutoCompleting:(BOOL)autoCompleting
532542 _autoCompleting = autoCompleting;
533543
534544 self.scrollViewProxy .scrollEnabled = !autoCompleting;
535-
536- if (UI_IS_IOS8_AND_HIGHER ) {
537- // Updates the iOS8 QuickType bar mode based on the keyboard height constant
538- CGFloat quicktypeBarHeight = self.keyboardHC .constant -minimumKeyboardHeight ();
539-
540- // Updates the QuickType bar mode based on the keyboard height constant
541- self.quicktypeBarMode = SLKQuicktypeBarModeForHeight (quicktypeBarHeight);
542- }
543545}
544546
545547- (void )setInverted : (BOOL )inverted
@@ -636,6 +638,11 @@ - (void)textWillUpdate
636638
637639- (void )textDidUpdate : (BOOL )animated
638640{
641+ // Disables animation if not first responder
642+ if (![self .textView isFirstResponder ]) {
643+ animated = NO ;
644+ }
645+
639646 self.textInputbar .rightButton .enabled = [self canPressRightButton ];
640647 self.textInputbar .editortRightButton .enabled = [self canPressRightButton ];
641648
@@ -872,8 +879,7 @@ - (void)scrollToBottomIfNeeded
872879
873880- (void )enableTypingSuggestionIfNeeded
874881{
875- // Skips if the QuickType Bar is minimised
876- if (self.quicktypeBarMode == SLKQuicktypeBarModeCollapsed) {
882+ if (![self .textView isFirstResponder ]) {
877883 return ;
878884 }
879885
@@ -883,8 +889,12 @@ - (void)enableTypingSuggestionIfNeeded
883889 enable = NO ;
884890 }
885891
886- // On iOS8, when the predictive mode is enabled, the QuicktypeBar is hidden
887- // On iOS7, it should always disable auto-correction and spell checking if autocompletion is enabled.
892+ // Skips if the QuickType Bar isn't visible and it's trying to disable it. And the inverted logic.
893+ if (UI_IS_IOS8_AND_HIGHER && ((enable == NO && !self.isQuickTypeBarVisible ) || (enable == YES && self.isQuickTypeBarVisible ))) {
894+ return ;
895+ }
896+
897+ // During text autocompletion, the iOS 8 QuickType bar is hidden and auto-correction and spell checking are disabled.
888898 [self .textView setTypingSuggestionEnabled: enable];
889899}
890900
0 commit comments