Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update TextInput inputMode to map "none" to showSoftInputOnFocus #35228

Conversation

gabrieldonadel
Copy link
Collaborator

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
Screen.Recording.2022-11-07.at.00.08.58.mov

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 7, 2022
@necolas
Copy link
Contributor

necolas commented Nov 7, 2022

I wonder if this should be a little more complicated in case it's bizarre to have an inputMode set and the showSoftInputOnFocus set. Should the latter be ignored entirely if inputMode is defined?

@analysis-bot
Copy link

analysis-bot commented Nov 7, 2022

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 7a327d9
Branch: main

@analysis-bot
Copy link

analysis-bot commented Nov 7, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 6,995,403 -70,774
android hermes armeabi-v7a 6,371,933 -66,628
android hermes x86 7,408,083 -73,412
android hermes x86_64 7,272,085 -68,804
android jsc arm64-v8a 8,861,185 -70,810
android jsc armeabi-v7a 7,599,700 -66,639
android jsc x86 8,918,931 -73,435
android jsc x86_64 9,402,287 -68,834

Base commit: 7a327d9
Branch: main

@pull-bot
Copy link

pull-bot commented Nov 7, 2022

PR build artifact for 0b660f4 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@gabrieldonadel
Copy link
Collaborator Author

I wonder if this should be a little more complicated in case it's bizarre to have an inputMode set and the showSoftInputOnFocus set. Should the latter be ignored entirely if inputMode is defined?

@necolas we could do showSoftInputOnFocus={inputMode === 'none' ? false || showSoftInputOnFocus : showSoftInputOnFocus} if you guys prefer

@facebook-github-bot
Copy link
Contributor

@jacdebug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@necolas
Copy link
Contributor

necolas commented Nov 7, 2022

I was thinking more like inputMode == null ? showSoftInputOnFocus : inputMode !== 'none'

@gabrieldonadel
Copy link
Collaborator Author

I was thinking more like inputMode == null ? showSoftInputOnFocus : inputMode !== 'none'

Got it, I've just updated it to use this logic

@necolas
Copy link
Contributor

necolas commented Nov 7, 2022

Thanks. We'll reimport and double check

@facebook-github-bot
Copy link
Contributor

@jacdebug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@pull-bot
Copy link

pull-bot commented Nov 7, 2022

PR build artifact for dc20e4e is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @gabrieldonadel in b6869be.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Nov 8, 2022
@gabrieldonadel gabrieldonadel deleted the feat/update-input-mode-behavior branch November 8, 2022 01:51
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
facebook#35228)

Summary:
This PR updates `inputMode` prop from the `TextInput` component to map the `none` option to `showSoftInputOnFocus={false}`  as suggested by necolas here -> facebook#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: facebook#35228

Reviewed By: lunaleaps, necolas

Differential Revision: D41081876

Pulled By: jacdebug

fbshipit-source-id: cc634c3723647d8950bf2cfe67be70d0fbd488a6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants