From bf3698323d81508fc77174df2b1ffe5fb03224e7 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Sun, 8 Oct 2017 21:41:38 -0700 Subject: [PATCH] RCTTextInput: Fixed problem with accessory view & 3rd party libs Summary: Now RCTTextInput relies on ivar to detect should it reconstruct inputAccessoryView or not. Previously we checked `inputAccessoryView` directly which breaks some 3rd party libs. See https://github.com/facebook/react-native/issues/16071 for more details. cc douglasjunior Reviewed By: javache Differential Revision: D5994798 fbshipit-source-id: c086efdd24f5528393a4c734ff7c984e0ed740d1 --- Libraries/Text/RCTTextInput.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Libraries/Text/RCTTextInput.m b/Libraries/Text/RCTTextInput.m index d949437a46d59a..8cf7ff60895cd5 100644 --- a/Libraries/Text/RCTTextInput.m +++ b/Libraries/Text/RCTTextInput.m @@ -21,6 +21,7 @@ @implementation RCTTextInput { CGSize _previousContentSize; + BOOL _hasInputAccesoryView; } - (instancetype)initWithBridge:(RCTBridge *)bridge @@ -304,12 +305,12 @@ - (void)invalidateInputAccessoryView ) && textInputView.returnKeyType == UIReturnKeyDone; - BOOL hasInputAccesoryView = textInputView.inputAccessoryView != nil; - - if (hasInputAccesoryView == shouldHaveInputAccesoryView) { + if (_hasInputAccesoryView == shouldHaveInputAccesoryView) { return; } + _hasInputAccesoryView = shouldHaveInputAccesoryView; + if (shouldHaveInputAccesoryView) { UIToolbar *toolbarView = [[UIToolbar alloc] init]; [toolbarView sizeToFit];