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
This commit is contained in:
Valentin Shergin 2017-10-08 21:41:38 -07:00 committed by Facebook Github Bot
parent 5e25c0e32f
commit bf3698323d
1 changed files with 4 additions and 3 deletions

View File

@ -21,6 +21,7 @@
@implementation RCTTextInput {
CGSize _previousContentSize;
BOOL _hasInputAccesoryView;
}
- (instancetype)initWithBridge:(RCTBridge *)bridge
@ -304,12 +305,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
) &&
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];