Skip to content

Commit

Permalink
Resolve React-RCTText Xcode warning (#28054)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
safaiyeh authored and facebook-github-bot committed Feb 13, 2020
1 parent 824e171 commit 04fed65
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions Libraries/Text/TextInput/RCTBaseTextInputView.m
Original file line number Diff line number Diff line change
Expand Up @@ -585,14 +585,25 @@ - (void)setDefaultInputAccessoryView

// 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;
Expand Down

0 comments on commit 04fed65

Please sign in to comment.