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

[TextInput] Implements 'onKeyPress' for Android - PR fixes #12301

Closed
wants to merge 2 commits into from

Conversation

adasiewiczr
Copy link

Link to original PR : #10665

It seems that author of the pull request from the link above has finished work on his PR, so I did a fork of his repository and I applied requested changes.

An attempt at the Android implementation. Attempted to mirror the iOS implementation by supporting 'Enter' and 'Backspace'.

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions.

@mkonicek
Copy link
Contributor

mkonicek commented Feb 9, 2017

Thanks for reviving this!

I have a n00b question - what's the use case for onKeyPress in apps? Is it to detect when Enter and Backspace are pressed?
http://stackoverflow.com/questions/35764782/identify-return-key-action-in-react-native

I'm asking because there's also the onChange event that can be used react to changes to the contents of the text input, including when each character is typed (including Enter and Backspace maybe?).

@mxaly
Copy link

mxaly commented Feb 10, 2017

@mkonicek backspace is the one that i'm currently lacking on android and using on ios. On ios i was able to successfully build messenger like functionality for choosing/searching users (see creating new message screen) and used backspace to select and then remove last element.

onChange is not fired when pressing backspace in empty input so can't use that in my case :(

@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 Feb 17, 2017
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@woshi82
Copy link

woshi82 commented Mar 9, 2017

+1
onChange is not fired when pressing backspace in empty input so can't use that in my case :(

have any update? the PR is not work for me ,maybe there is something wrong in my code.

my use case is:
there are 5 textInput in my view, when i enter one word in textInput,it should auto focus the next textInput. when i delete the word ,if the length of the textInput's value is 0, it should auto focus prev textInput's. it's all OK with the onChangeText method.

but when the length of the textInput's value is 0 ,and i press the delete key in android, nothing get work.
image

@mxaly
Copy link

mxaly commented Jun 7, 2017

@mkonicek any updates here?

@codingrhythm
Copy link

@woshi82 you should use a hidden input to handle input, and just display the digits using normal Text and styles. It's way easier than handle 4 different text inputs

@facebook-github-bot
Copy link
Contributor

@adasiewiczr I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project.

@AvijitDutta95
Copy link

@codingrhythm I like your solution but how can I use a hidden input in react native? I can't find much info on this online. Thanks!

@codingrhythm
Copy link

@AvijitDutta95 just change the opacity to 0

@shukerullah
Copy link

any updates here?

@dmueller39
Copy link

@adasiewiczr Any interest completing this? I would be happy to pick it up from here.

@Ashoat
Copy link
Contributor

Ashoat commented Sep 28, 2017

Heads-up that #14720 is happening in parallel to this one

@dmueller39
Copy link

@Ashoat That's really bizarre, @joshyhargreaves is actually a teammate of mine, and I had no idea he had that PR in the pipeline. Small world!

@ollyde
Copy link

ollyde commented Oct 19, 2017

Any progress on this, could really use it right now :-/

@BalalRaza
Copy link

@codingrhythm, is there a way to make user input data in some pre-described format? Suppose, I want to enter the value of a alpha-numeric code which goes like ABC123Z. I am currently using 3 input fields - one for the first ABC part, second for the numeric part and third for the last alphabet. I need the same use-case as required by @woshi82. How do I use a hidden input field in this case? Any help would be appreciated.

@stale
Copy link

stale bot commented Dec 29, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Dec 29, 2017
@stale stale bot closed this Jan 5, 2018
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. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.