Add key action info to Android EventHandler events.#25300
Conversation
|
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. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
|
@aamalric Before I can merge this commit, would you mind signing the CLA at code.facebook.com/cla? It only takes one minute. Thank you! |
|
@cpojer Yes for sure we will soon sign the CLA |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
This pull request was successfully merged by @aamalric in d010fc3. When will my fix make it into a release? | Upcoming Releases |
|
This results in double Hmmm I may be wrong about the source of the issue but for some reason I am receiving double |
|
@dblachut-adb Hi, yes now when you press one button on TV, you'll have 2 events onPress but with 2 differents events:
You'll have to make the check on this event if you need to handle the press only. |
|
IMHO this is not good as I would not normally expect to receive two events for single press in one handler. Correct me if I am wrong but in web environment there are two separated events for it. In non-tv RN As this is a breaking change and a bit counterintuitive it would be great to provide separate callbacks or if this is really desired it should be documented. Also - do you know how is this handled on AppleTV? Didn't this commit broke the compatibility between those two platforms? I have just started to wonder... |
|
On TV you have to use the TVEventHandler wich allows you to listen to events for events not specifically 'onPress' like you said. |
|
Yes there is and it is specifically described in the link that you have provided. I am talking about
You are talking about 'global' event handler, maybe that is where we don't understand each other. Does your change affect only global event handler? |
|
My changes were originally made to detect a press from a release on TVEventHandler events. |
|
Okay sure, but if I am not mistaken this could affect the I have just checked and your changes are not yet published in any release So my issue with double Would you mind checking how does Touchable |
|
I can see that somebody have already filed an issue for it: #25979 |
|
I also have the same problem. Using the mouse works fine, but using a keyboard or box control onPress runs twice |
|
This was a pretty major breaking change for us that we did not anticipate... |
@mtkopone Are you sure that this change is the cause? As I have mentioned - it is not yet released under any version. |
|
Looking at the code, I think the problem is in this "OR" of print. It checks two button click actions when you press the button and when you release it. I may be wrong, but I think the problem is because of this. I think I needed to check only 1 of the actions.
|
|
That was my first assumption as well, but this commit is not yet released to any RN version which means that you would have to:
|
Summary: Add event key action for Android EventHandler events, helps to know if the key event is a up (key release, value is 1) or down (key pressed, value is 0) action. ## Changelog [ANDROID] [ADDED] - Add event key action to EventHandler events. Pull Request resolved: facebook#25300 Test Plan: No test added Differential Revision: D15897484 Pulled By: cpojer fbshipit-source-id: fdb3d5413d9da3dd5f46d41e31ac60f0b341f3eb
|
This thread is a year old and I still don't understand why onLongPress, onPress, onPressIn, onPressOut are handled as you would expect by touch but then onLongPress, onPressIn, onPressOut have no effect on a keypress, instead just firing onPress 3 times and expecting you to deal with it? |
Summary
Add event key action for Android EventHandler events, helps to know if the key event is a up (key release, value is 1) or down (key pressed, value is 0) action.
Changelog
[ANDROID] [ADDED] - Add event key action to EventHandler events.
Test Plan
No test added