From b6869be1ac0bedcb846722160f29fb4591ae5013 Mon Sep 17 00:00:00 2001 From: Gabriel Donadel Dall'Agnol Date: Mon, 7 Nov 2022 17:43:10 -0800 Subject: [PATCH] feat: Update TextInput inputMode to map "none" to showSoftInputOnFocus (#35228) Summary: This PR updates `inputMode` prop from the `TextInput` component to map the `none` option to `showSoftInputOnFocus={false}` as suggested by necolas here -> https://github.com/facebook/react-native/pull/34460#issuecomment-1304837271. This change makes the inputMode API behaves a bit more similarly across platforms. Related to https://github.com/necolas/react-native-web/issues/2421 ## Changelog [General] [Changed] - Update TextInput inputMode to map "none" to showSoftInputOnFocus ## Test Plan 1. Open the RNTester app and navigate to the TextInput page 2. Test the `TextInput` component through the `Input modes` section https://user-images.githubusercontent.com/11707729/200218435-6a33b319-e989-4086-aac3-506546982b38.mov Pull Request resolved: https://github.com/facebook/react-native/pull/35228 Reviewed By: lunaleaps, necolas Differential Revision: D41081876 Pulled By: jacdebug fbshipit-source-id: cc634c3723647d8950bf2cfe67be70d0fbd488a6 --- Libraries/Components/TextInput/TextInput.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index 386e6b87c8822e..ada8c7bcdc9af6 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -1602,6 +1602,7 @@ const ExportedForwardRef: React.AbstractComponent< enterKeyHint, returnKeyType, inputMode, + showSoftInputOnFocus, keyboardType, ...restProps }, @@ -1628,6 +1629,9 @@ const ExportedForwardRef: React.AbstractComponent< keyboardType={ inputMode ? inputModeToKeyboardTypeMap[inputMode] : keyboardType } + showSoftInputOnFocus={ + inputMode == null ? showSoftInputOnFocus : inputMode !== 'none' + } autoComplete={ Platform.OS === 'android' ? // $FlowFixMe