-
Notifications
You must be signed in to change notification settings - Fork 24.7k
feat: Manage keyboard shortcuts visibility of TextInput #47671
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: Manage keyboard shortcuts visibility of TextInput #47671
Conversation
…nd ObjC land (facebook#47532)" This reverts commit 4dd60ac.
packages/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.h
Outdated
Show resolved
Hide resolved
packages/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.cpp
Outdated
Show resolved
Hide resolved
packages/rn-tester/js/examples/Playground/RNTesterPlayground.js
Outdated
Show resolved
Hide resolved
...ges/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm
Outdated
Show resolved
Hide resolved
packages/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.mm
Outdated
Show resolved
Hide resolved
packages/react-native/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h
Show resolved
Hide resolved
Sorry for the delay. I'm about to log off for a week of PTO. I'll have a look at this when I'm back, unless some of my colleagues take care of that before. |
I've done a quick pass and overall the code looks good to me. However we'll have to wait for @cipolleschi to be back next week for a final pass as iOS expert |
@rezkiy37 Thanks for the proposal and for the PR. Can I ask you what's your use case, specifically?
|
Hello @cipolleschi! 372854999-dbd0e4ef-066c-462a-8ca1-828d212a5808.mp4As shown, the user cannot effectively interact with buttons on the iPad when the input is focused, but the native keyboard is hidden. This is why I propose introducing this new API to address such scenarios. Regarding your third point, I understand the concern about maintainability. However, this PR introduces the new property with a default value of As for point 4, I agree that this is an iOS-specific edge case, but it is one that still needs to be handled. To clarify, this issue does not occur on Android, as shown in the video below: Video
Android.mp4
In that case, we could extend support for Android, enhancing the UX for both platforms.
This property would be clearly marked as iOS-specific, similar to existing properties like Thank you again for your time and consideration! |
…feat/disable-keyboard-shortcuts-2
…feat/disable-keyboard-shortcuts-2
Hi there, CI is red. Could you please rebase on main and update the pr to fix the |
…feat/disable-keyboard-shortcuts-2
@cipolleschi, please approve the workflow 🙂 |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
JS tests are red. :( |
the public API file must be updated |
…feat/disable-keyboard-shortcuts-2
@cipolleschi, I've updated the public API snapshot - 9e22ee0. |
…feat/disable-keyboard-shortcuts-2
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Hi! Wishing you a Happy New Year! |
@cipolleschi merged this pull request in 0154372. |
This pull request was successfully merged by @rezkiy37 in 0154372 When will my fix make it into a release? | How to file a pick request? |
I've opened a PR to update the doc - facebook/react-native-website#4434. |
@rezkiy37 that's great, thank you for following up on this and improving our docs! |
Summary:
iOS does offer a native property for UITextField called
inputAssistantItem
. According to the documentation, we can hide the "shortcuts" by setting theleadingBarButtonGroups
andtrailingBarButtonGroups
properties to empty arrays.I propose adding a new property for TextInput in React Native, which would set these native properties to empty arrays. This new property could be called
disableInputAssistant
ordisableKeyboardShortcuts
and would be aboolean
.Developers can manage this behavior (the redo & undo buttons and suggestions pop-up hiding) after applying these native props.
react-native-community/discussions-and-proposals#830
Changelog:
[IOS] [ADDED] - [TextInput] Integrate a new property -
disableKeyboardShortcuts
. It can disable the keyboard shortcuts on iPads.Test Plan:
Manual
Note: TextInput behaves the same as now when the new prop is not passed or is
false
.Example.mp4