react-native icon indicating copy to clipboard operation
react-native copied to clipboard

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

Open gabrieldonadel opened this issue 3 years ago • 6 comments

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

gabrieldonadel avatar Nov 07 '22 03:11 gabrieldonadel

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 avatar Nov 07 '22 03:11 necolas

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

Base commit: 7a327d967357ecf04ddd64b6f6661dd1e7f0ea22 Branch: main

analysis-bot avatar Nov 07 '22 03:11 analysis-bot

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

analysis-bot avatar Nov 07 '22 03:11 analysis-bot

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.

pull-bot avatar Nov 07 '22 03:11 pull-bot

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

gabrieldonadel avatar Nov 07 '22 03:11 gabrieldonadel

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

facebook-github-bot avatar Nov 07 '22 14:11 facebook-github-bot

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

necolas avatar Nov 07 '22 18:11 necolas

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

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

gabrieldonadel avatar Nov 07 '22 20:11 gabrieldonadel

Thanks. We'll reimport and double check

necolas avatar Nov 07 '22 20:11 necolas

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

facebook-github-bot avatar Nov 07 '22 20:11 facebook-github-bot

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.

pull-bot avatar Nov 07 '22 21:11 pull-bot

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

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

react-native-bot avatar Nov 08 '22 01:11 react-native-bot