From 76604e7c5c07a58197bfe852455af6e0c238fb7d Mon Sep 17 00:00:00 2001 From: Jason Safaiyeh Date: Thu, 13 Feb 2020 12:41:22 -0800 Subject: [PATCH] Resolve React-RCTText Xcode warning (#28054) Summary: Resolve React-RCTText warning: `'UIKeyboardTypeASCIICapableNumberPad' is only available on iOS 10.0 or newer` ## Changelog [iOS] [Fixed] - Resolve React-RCTText Xcode warning Pull Request resolved: https://github.com/facebook/react-native/pull/28054 Test Plan: Build template, React-RCTText should no longer throw a warning. Differential Revision: D19887063 Pulled By: hramos fbshipit-source-id: 3437ee993babd7cdaec259af24526e197acb64bb --- .../Text/TextInput/RCTBaseTextInputView.m | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.m b/Libraries/Text/TextInput/RCTBaseTextInputView.m index 6966dbd7f09..b9882d34efa 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.m @@ -569,14 +569,25 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) // These keyboard types (all are number pads) don't have a "Done" button by default, // so we create an `inputAccessoryView` with this button for them. - BOOL shouldHaveInputAccesoryView = - ( - keyboardType == UIKeyboardTypeNumberPad || - keyboardType == UIKeyboardTypePhonePad || - keyboardType == UIKeyboardTypeDecimalPad || - keyboardType == UIKeyboardTypeASCIICapableNumberPad - ) && - textInputView.returnKeyType == UIReturnKeyDone; + BOOL shouldHaveInputAccesoryView; + if (@available(iOS 10.0, *)) { + shouldHaveInputAccesoryView = + ( + keyboardType == UIKeyboardTypeNumberPad || + keyboardType == UIKeyboardTypePhonePad || + keyboardType == UIKeyboardTypeDecimalPad || + keyboardType == UIKeyboardTypeASCIICapableNumberPad + ) && + textInputView.returnKeyType == UIReturnKeyDone; + } else { + shouldHaveInputAccesoryView = + ( + keyboardType == UIKeyboardTypeNumberPad || + keyboardType == UIKeyboardTypePhonePad || + keyboardType == UIKeyboardTypeDecimalPad + ) && + textInputView.returnKeyType == UIReturnKeyDone; + } if (_hasInputAccesoryView == shouldHaveInputAccesoryView) { return;