-
Notifications
You must be signed in to change notification settings - Fork 30
feat: add returnKeyType, submitBehavior, onSubmitEditing, returnKeyLabel props #379
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
base: main
Are you sure you want to change the base?
feat: add returnKeyType, submitBehavior, onSubmitEditing, returnKeyLabel props #379
Conversation
|
Unfortunately on Android this PR makes that when we press enter in input nothing happens: Screen.Recording.2026-01-19.at.12.50.06.movEven when I pass prop: |
|
About second point: I tested it on Screen.Recording.2026-01-19.at.13.03.54.movSo we can drop support for this prop on Android |
|
If I add at the same time and press on label there is a crash on Android: Screen.Recording.2026-01-19.at.13.26.03.movWhen we will drop support for |
e900c88 to
91e68e4
Compare
|
@kacperzolkiewski I've made requested changes + regarding the crash on Android when we press on action label. This crash is happening right now on main branch too. It is happening because for some reason this text input thinks that there is some other text input that it should focus on after the action label is pressed and since there is no other text inputs - it crashes with "focus search returned a view that wasn't able to take focus!". I've added commit that sets up ime action label in prepareComponent to unspecified action so that the crash would be avoided, but ideally there should be an ability to focus on next text input on ime action label press if there are any. (probably should be done separately, not in this PR) + not sure if it's a big deal or not but on Android when we pass "blurAndSubmit" for example and we hit Enter - we also receive a text changed event, not just submit editing event. Since I can't think of anything else but a hacky way to handle this (creating a boolean variable ignoreAfterTextChanged that sets to true in onTextChanged and then sets to false in afterTextChanged) I'm not sure what would be the best approach here. |
6125334 to
f4feec2
Compare
|
@IslamRustamov, What do you think about that? |
|
I think that's the most correct way to do that. I initially tried to use the same thing but due to lack of proper knowledge of Android development I didn't set up onEditorAction correctly and it just didn't fire for me. |
Summary
Fixes: #295
Test Plan
To verify that the props work set the corresponding props on the text input and see how they work.
Note that returnKeyLabel is visible only in landscape mode.
Screenshots / Videos
Custom returnKeyLabel:
Custom returnKeyTypes:
I advise you to test such props as submitBehavior, onSubmitEditing yourself by pulling this branch and testing them manually.
Compatibility
IMPORTANT NOTES
Some of the things were probably implemented poorly so I advice you to not hesitate and jump in with proposals/your own changes in this PR since I might not quickly return to this task.
type SomeType = "one" | "two" | "three"and I can't comprehend how to use. If you have a better idea how to deal with it - please inform me about that;