Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public class ReactAndroidHWInputDeviceHelper {
public void handleKeyEvent(KeyEvent ev) {
int eventKeyCode = ev.getKeyCode();
int eventKeyAction = ev.getAction();
if (eventKeyAction == KeyEvent.ACTION_UP && KEY_EVENTS_ACTIONS.containsKey(eventKeyCode)) {
dispatchEvent(KEY_EVENTS_ACTIONS.get(eventKeyCode), mLastFocusedViewId);
if ((eventKeyAction == KeyEvent.ACTION_UP || eventKeyAction == KeyEvent.ACTION_DOWN) && KEY_EVENTS_ACTIONS.containsKey(eventKeyCode)) {
dispatchEvent(KEY_EVENTS_ACTIONS.get(eventKeyCode), mLastFocusedViewId, eventKeyAction);
}
}

Expand Down Expand Up @@ -88,8 +88,13 @@ public void clearFocus() {
}

private void dispatchEvent(String eventType, int targetViewId) {
dispatchEvent(eventType, targetViewId, -1);
}

private void dispatchEvent(String eventType, int targetViewId, int eventKeyAction) {
WritableMap event = new WritableNativeMap();
event.putString("eventType", eventType);
event.putInt("eventKeyAction", eventKeyAction);
if (targetViewId != View.NO_ID) {
event.putInt("tag", targetViewId);
}
Expand Down