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
@@ -221,6 +221,7 @@ public class ReactTextInputPropertyTest {
public void testKeyboardType() {
ReactEditText view = mManager.createViewInstance(mThemedContext);
int numberPadTypeFlags = InputType.TYPE_CLASS_NUMBER;
int urlTypeFlags = InputType.TYPE_TEXT_VARIATION_URI;
int decimalPadTypeFlags = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL;
int numericTypeFlags =
InputType.TYPE_CLASS_NUMBER
@@ -246,6 +247,9 @@ public class ReactTextInputPropertyTest {
mManager.updateProperties(view, buildStyles("keyboardType", "number-pad"));
assertThat(view.getInputType() & generalKeyboardTypeFlags).isEqualTo(numberPadTypeFlags);
mManager.updateProperties(view, buildStyles("keyboardType", "url"));
assertThat(view.getInputType() & generalKeyboardTypeFlags).isEqualTo(urlTypeFlags);
mManager.updateProperties(view, buildStyles("keyboardType", "decimal-pad"));
assertThat(view.getInputType() & generalKeyboardTypeFlags).isEqualTo(decimalPadTypeFlags);