Skip to content

Commit

Permalink
feat: Update TextInput inputMode to map "none" to showSoftInputOnFocus (
Browse files Browse the repository at this point in the history
#35228)

Summary:
This PR updates `inputMode` prop from the `TextInput` component to map the `none` option to `showSoftInputOnFocus={false}`  as suggested by necolas here -> #34460 (comment). This change makes the inputMode API behaves a bit more similarly across platforms.

Related to necolas/react-native-web#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: #35228

Reviewed By: lunaleaps, necolas

Differential Revision: D41081876

Pulled By: jacdebug

fbshipit-source-id: cc634c3723647d8950bf2cfe67be70d0fbd488a6
  • Loading branch information
gabrieldonadel authored and facebook-github-bot committed Nov 8, 2022
1 parent 7a327d9 commit b6869be
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -1602,6 +1602,7 @@ const ExportedForwardRef: React.AbstractComponent<
enterKeyHint,
returnKeyType,
inputMode,
showSoftInputOnFocus,
keyboardType,
...restProps
},
Expand All @@ -1628,6 +1629,9 @@ const ExportedForwardRef: React.AbstractComponent<
keyboardType={
inputMode ? inputModeToKeyboardTypeMap[inputMode] : keyboardType
}
showSoftInputOnFocus={
inputMode == null ? showSoftInputOnFocus : inputMode !== 'none'
}
autoComplete={
Platform.OS === 'android'
? // $FlowFixMe
Expand Down

0 comments on commit b6869be

Please sign in to comment.