Skip to content

Commit

Permalink
Fix event handlers for DPad arrows on Android TV (#21143)
Browse files Browse the repository at this point in the history
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Fixes #20924
DPad arrow events were missing from `KEY_EVENTS_ACTIONS` which meant that they were not broadcasted by `TVEventHandler`.
Pull Request resolved: #21143

Differential Revision: D10007851

Pulled By: mdvacca

fbshipit-source-id: 9a03cad249a4a1917975d1de10b6112e69d32a72
  • Loading branch information
Krzysztof Ciombor authored and facebook-github-bot committed Sep 24, 2018
1 parent 421667c commit 4d71b15
Showing 1 changed file with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,18 @@ public class ReactAndroidHWInputDeviceHelper {
* Contains a mapping between handled KeyEvents and the corresponding navigation event
* that should be fired when the KeyEvent is received.
*/
private static final Map<Integer, String> KEY_EVENTS_ACTIONS = MapBuilder.of(
KeyEvent.KEYCODE_DPAD_CENTER,
"select",
KeyEvent.KEYCODE_ENTER,
"select",
KeyEvent.KEYCODE_SPACE,
"select",
KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE,
"playPause",
KeyEvent.KEYCODE_MEDIA_REWIND,
"rewind",
KeyEvent.KEYCODE_MEDIA_FAST_FORWARD,
"fastForward"
);
private static final Map<Integer, String> KEY_EVENTS_ACTIONS = MapBuilder.<Integer, String>builder()
.put(KeyEvent.KEYCODE_DPAD_CENTER, "select")
.put(KeyEvent.KEYCODE_ENTER, "select")
.put(KeyEvent.KEYCODE_SPACE, "select")
.put(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE, "playPause")
.put(KeyEvent.KEYCODE_MEDIA_REWIND, "rewind")
.put(KeyEvent.KEYCODE_MEDIA_FAST_FORWARD, "fastForward")
.put(KeyEvent.KEYCODE_DPAD_UP, "up")
.put(KeyEvent.KEYCODE_DPAD_RIGHT, "right")
.put(KeyEvent.KEYCODE_DPAD_DOWN, "down")
.put(KeyEvent.KEYCODE_DPAD_LEFT, "left")
.build();

/**
* We keep a reference to the last focused view id
Expand Down

0 comments on commit 4d71b15

Please sign in to comment.