From 6d9fe455dc815cdce86c00f81c71c9ca0c724964 Mon Sep 17 00:00:00 2001 From: Peter Argany Date: Tue, 27 Feb 2018 17:39:46 -0800 Subject: [PATCH] Fixed TVOS test failure caused by input accessory view change Reviewed By: mmmulani Differential Revision: D7103353 fbshipit-source-id: 7a1575eff0296017521fc8ca6fe384301849a73e --- Libraries/Text/TextInput/RCTBaseTextInputView.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.m b/Libraries/Text/TextInput/RCTBaseTextInputView.m index 025fb0e41..d9c47ff16 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.m @@ -402,17 +402,16 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) - (void)didSetProps:(NSArray *)changedProps { - #if !TARGET_OS_TV if ([changedProps containsObject:@"inputAccessoryViewID"] && self.inputAccessoryViewID) { [self setCustomInputAccessoryViewWithNativeID:self.inputAccessoryViewID]; } else if (!self.inputAccessoryViewID) { [self setDefaultInputAccessoryView]; } - #endif } - (void)setCustomInputAccessoryViewWithNativeID:(NSString *)nativeID { + #if !TARGET_OS_TV __weak RCTBaseTextInputView *weakSelf = self; [_bridge.uiManager rootViewForReactTag:self.reactTag withCompletion:^(UIView *rootView) { RCTBaseTextInputView *strongSelf = weakSelf; @@ -425,10 +424,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) } } }]; + #endif /* !TARGET_OS_TV */ } - (void)setDefaultInputAccessoryView { + #if !TARGET_OS_TV UIView *textInputView = self.backedTextInputView; UIKeyboardType keyboardType = textInputView.keyboardType; @@ -467,6 +468,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) textInputView.inputAccessoryView = nil; } [self reloadInputViewsIfNecessary]; + #endif /* !TARGET_OS_TV */ } - (void)reloadInputViewsIfNecessary