Add support to URI keyboard type in Android (#31781)

Summary:
Android react-native `TextInput` component does nothing if prop `keyboardType` is `url` value. This PR solves that problem.

## Changelog

[Android] [Added] - Add support to URI keyboard type in Android

Pull Request resolved: https://github.com/facebook/react-native/pull/31781

Test Plan:
Before change:

{F630980679}

After Change:

{F630986399}

Reviewed By: lunaleaps

Differential Revision: D29517822

Pulled By: sshic

fbshipit-source-id: 1bda29584a3799570f34e772b5589b59ac80c524
This commit is contained in:
Adrián Cuesta
2021-07-16 05:13:07 -07:00
committed by Facebook GitHub Bot
parent 2970de9400
commit 1465c8f387
6 changed files with 17 additions and 9 deletions
@@ -108,6 +108,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
private static final String KEYBOARD_TYPE_NUMBER_PAD = "number-pad";
private static final String KEYBOARD_TYPE_PHONE_PAD = "phone-pad";
private static final String KEYBOARD_TYPE_VISIBLE_PASSWORD = "visible-password";
private static final String KEYBOARD_TYPE_URI = "url";
private static final InputFilter[] EMPTY_FILTERS = new InputFilter[0];
private static final int UNSET = -1;
@@ -774,6 +775,8 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
// This will supercede secureTextEntry={false}. If it doesn't, due to the way
// the flags work out, the underlying field will end up a URI-type field.
flagsToSet = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
} else if (KEYBOARD_TYPE_URI.equalsIgnoreCase(keyboardType)) {
flagsToSet = InputType.TYPE_TEXT_VARIATION_URI;
}
updateStagedInputTypeFlag(view, InputType.TYPE_MASK_CLASS, flagsToSet);