feat: Update TextInput inputMode to map "none" to showSoftInputOnFocus
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
- Open the RNTester app and navigate to the TextInput page
- Test the
TextInputcomponent through theInput modessection
https://user-images.githubusercontent.com/11707729/200218435-6a33b319-e989-4086-aac3-506546982b38.mov
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?
| Platform | Engine | Arch | Size (bytes) | Diff |
|---|---|---|---|---|
| ios | - | universal | n/a | -- |
Base commit: 7a327d967357ecf04ddd64b6f6661dd1e7f0ea22 Branch: main
| 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: 7a327d967357ecf04ddd64b6f6661dd1e7f0ea22 Branch: main
PR build artifact for 0b660f4a977f9d442d997adb352b86fd748bc460 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.
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
@jacdebug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
I was thinking more like inputMode == null ? showSoftInputOnFocus : inputMode !== 'none'
I was thinking more like
inputMode == null ? showSoftInputOnFocus : inputMode !== 'none'
Got it, I've just updated it to use this logic
Thanks. We'll reimport and double check
@jacdebug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
PR build artifact for dc20e4eeced77a145a578d6254feb6e14458a170 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.
This pull request was successfully merged by @gabrieldonadel in b6869be1ac0bedcb846722160f29fb4591ae5013.
When will my fix make it into a release? | Upcoming Releases