Skip to content

Commit 04fed65

Browse files
safaiyehfacebook-github-bot
authored andcommitted
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: #28054 Test Plan: Build template, React-RCTText should no longer throw a warning. Differential Revision: D19887063 Pulled By: hramos fbshipit-source-id: 3437ee993babd7cdaec259af24526e197acb64bb
1 parent 824e171 commit 04fed65

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

Libraries/Text/TextInput/RCTBaseTextInputView.m

+19-8
Original file line numberDiff line numberDiff line change
@@ -585,14 +585,25 @@ - (void)setDefaultInputAccessoryView
585585

586586
// These keyboard types (all are number pads) don't have a "Done" button by default,
587587
// so we create an `inputAccessoryView` with this button for them.
588-
BOOL shouldHaveInputAccesoryView =
589-
(
590-
keyboardType == UIKeyboardTypeNumberPad ||
591-
keyboardType == UIKeyboardTypePhonePad ||
592-
keyboardType == UIKeyboardTypeDecimalPad ||
593-
keyboardType == UIKeyboardTypeASCIICapableNumberPad
594-
) &&
595-
textInputView.returnKeyType == UIReturnKeyDone;
588+
BOOL shouldHaveInputAccesoryView;
589+
if (@available(iOS 10.0, *)) {
590+
shouldHaveInputAccesoryView =
591+
(
592+
keyboardType == UIKeyboardTypeNumberPad ||
593+
keyboardType == UIKeyboardTypePhonePad ||
594+
keyboardType == UIKeyboardTypeDecimalPad ||
595+
keyboardType == UIKeyboardTypeASCIICapableNumberPad
596+
) &&
597+
textInputView.returnKeyType == UIReturnKeyDone;
598+
} else {
599+
shouldHaveInputAccesoryView =
600+
(
601+
keyboardType == UIKeyboardTypeNumberPad ||
602+
keyboardType == UIKeyboardTypePhonePad ||
603+
keyboardType == UIKeyboardTypeDecimalPad
604+
) &&
605+
textInputView.returnKeyType == UIReturnKeyDone;
606+
}
596607

597608
if (_hasInputAccesoryView == shouldHaveInputAccesoryView) {
598609
return;

0 commit comments

Comments
 (0)