From 6d478169275c6f3869c29247f9b0a7d012e3a3c3 Mon Sep 17 00:00:00 2001 From: fabriziobertoglio1987 Date: Tue, 20 Dec 2022 20:21:37 +0100 Subject: [PATCH] =?UTF-8?q?Add=20inputType=20textNoSuggestions=20in=20reac?= =?UTF-8?q?t-native=20to=20disable=20the=20autocomplete=20functionality=20?= =?UTF-8?q?(comment,=20comment-2,=20user-comment,=20user-comment-2)=20andr?= =?UTF-8?q?oid:inputType=3D=E2=80=9CtextFilter|textNoSuggestions=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit P | type | task -- | -- | -- 1 | review | Review information from your previous investigation (comment) 1.2 | review | Review comments from Issues #33139 (#30263, #35155, #35590, #35350) 2 | bug | Build RNTester on Android 13 and test TextInput example with Grammarly (example-without-scrollview, example-with-scrollview) 2.1 | task | Enter timemachine and restore previous android sdk configs in folder /Users/fabriziobertoglio/Library/Android/sdk 2.2 | task | Check sdk supported in build.gradle configs in react-native (commit) 2.3 | task | Read react-native environment setup instructions 2.4 | task | Follow instructions on discord to fix build error (1-2 hours) 3 | bug | Add inputType textNoSuggestions in react-native to disable the autocomplete functionality (comment, comment-2, user-comment, user-comment-2) android:inputType=“textFilter\|textNoSuggestions” 3.1 | task | Review implementation of InternalKeyListener 3.2 | task | Find configs inputMode in sourcecode (setKeyboardType) 3.3 | task | Add type “textFilter\|textNoSuggestions” to setKeyboardType 3.4 | task | Test that auto-corrections are disabled in a TextInput with Grammarly Keyboard 3.5 | task | Refactor functionality in branch 3.6 | task | Record test case P type task 1 review Review information from your previous investigation ([comment](https://github.com/facebook/react-native/issues/35590#issuecomment-1355221060)) 1.2 review Review comments from Issues [#33139](https://github.com/facebook/react-native/issues/33139) ([#30263](https://github.com/facebook/react-native/issues/30263), [#35155](https://github.com/facebook/react-native/issues/35155), [#35590](https://github.com/facebook/react-native/issues/35590), [#35350](https://github.com/facebook/react-native/issues/35350)) 2 bug Build RNTester on Android 13 and test TextInput example with Grammarly ([example-without-scrollview](https://github.com/facebook/react-native/issues/35155), [example-with-scrollview](https://github.com/facebook/react-native/issues/35590)) 2.1 task Enter timemachine and restore previous android sdk configs in folder /Users/fabriziobertoglio/Library/Android/sdk 2.2 task Check sdk supported in build.gradle configs in react-native ([commit](https://github.com/fabriziobertoglio1987/react-native/commit/394486eec584a37920dad447a6c1d0ae24d225fc)) 2.3 task Read react-native [environment setup instructions](https://reactnative.dev/docs/next/environment-setup) 2.4 task Follow [instructions on discord](https://discord.com/channels/514829729862516747/1050309907787808768/1050462841028743309) to fix build error (1-2 hours) 3 bug Add inputType textNoSuggestions in react-native to disable the autocomplete functionality ([comment](https://github.com/facebook/react-native/issues/35155#issuecomment-1358218925), [comment-2](https://github.com/facebook/react-native/issues/35590#issuecomment-1355221060), [user-comment](https://github.com/facebook/react-native/issues/33139#issuecomment-1288945016), [user-comment-2](https://github.com/facebook/react-native/issues/33139#issuecomment-1069560920)) android:inputType=“textFilter|textNoSuggestions” 3.1 task Review implementation of [InternalKeyListener](https://github.com/facebook/react-native/blob/76a14454d7f1f2b2ba8f5a79c2f640fafb42de6d/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java#L1153-L1168) 3.2 task Find configs [inputMode](https://reactnative.dev/docs/next/textinput#inputmode) in sourcecode ([setKeyboardType](https://github.com/facebook/react-native/blob/9f78517d6401f3a7ece453825a059a13b73f6140/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java#L849-L881)) 3.3 task Add type “textFilter|textNoSuggestions” to [setKeyboardType](https://github.com/facebook/react-native/blob/9f78517d6401f3a7ece453825a059a13b73f6140/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java#L849-L881) 3.4 task Test that auto-corrections are disabled in a TextInput with Grammarly Keyboard 3.5 task Refactor functionality in branch 3.6 task Record test case --- Libraries/Components/TextInput/TextInput.d.ts | 2 +- Libraries/Components/TextInput/TextInput.flow.js | 1 + Libraries/Components/TextInput/TextInput.js | 2 ++ .../facebook/react/views/textinput/ReactTextInputManager.java | 3 +++ .../rn-tester/js/examples/TextInput/TextInputSharedExamples.js | 3 +++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Libraries/Components/TextInput/TextInput.d.ts b/Libraries/Components/TextInput/TextInput.d.ts index 12cfec2987cb2a..37cf6e4ad1c7fe 100644 --- a/Libraries/Components/TextInput/TextInput.d.ts +++ b/Libraries/Components/TextInput/TextInput.d.ts @@ -39,7 +39,7 @@ export type KeyboardTypeIOS = | 'name-phone-pad' | 'twitter' | 'web-search'; -export type KeyboardTypeAndroid = 'visible-password'; +export type KeyboardTypeAndroid = 'no-suggestions' | 'visible-password'; export type KeyboardTypeOptions = | KeyboardType | KeyboardTypeAndroid diff --git a/Libraries/Components/TextInput/TextInput.flow.js b/Libraries/Components/TextInput/TextInput.flow.js index 57259190f1a449..a6b42f58775441 100644 --- a/Libraries/Components/TextInput/TextInput.flow.js +++ b/Libraries/Components/TextInput/TextInput.flow.js @@ -120,6 +120,7 @@ export type KeyboardType = // iOS 10+ only | 'ascii-capable-number-pad' // Android-only + | 'no-suggestions' | 'visible-password'; export type InputMode = diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index ec337de164ef8a..d5d5ffabb818b1 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -158,6 +158,7 @@ export type KeyboardType = // iOS 10+ only | 'ascii-capable-number-pad' // Android-only + | 'no-suggestions' | 'visible-password'; export type InputMode = @@ -677,6 +678,7 @@ export type Props = $ReadOnly<{| * * The following values work on Android only: * + * - `no-suggestions` * - `visible-password` * */ diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java index f4733dfcd2bc7e..a8396ea6bbbc31 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java @@ -165,6 +165,7 @@ public class ReactTextInputManager extends BaseViewManager