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 @@ -29,7 +29,13 @@ internal class ReactAndroidHWInputDeviceHelper {
(eventKeyAction == KeyEvent.ACTION_UP || eventKeyAction == KeyEvent.ACTION_DOWN) &&
KEY_EVENTS_ACTIONS.containsKey(eventKeyCode)
) {
dispatchEvent(context, KEY_EVENTS_ACTIONS[eventKeyCode], lastFocusedViewId, eventKeyAction)
dispatchEvent(
context,
KEY_EVENTS_ACTIONS[eventKeyCode],
lastFocusedViewId,
eventKeyAction,
ev.eventTime,
)
}
}

Expand Down Expand Up @@ -58,11 +64,15 @@ internal class ReactAndroidHWInputDeviceHelper {
eventType: String?,
targetViewId: Int,
eventKeyAction: Int = -1,
eventTime: Long = NO_EVENT_TIME,
) {
val event: WritableMap =
WritableNativeMap().apply {
putString("eventType", eventType)
putInt("eventKeyAction", eventKeyAction)
if (eventTime != NO_EVENT_TIME) {
putDouble("eventTime", eventTime.toDouble())
}
if (targetViewId != View.NO_ID) {
putInt("tag", targetViewId)
}
Expand All @@ -71,6 +81,8 @@ internal class ReactAndroidHWInputDeviceHelper {
}

private companion object {
private const val NO_EVENT_TIME: Long = -1

/**
* Contains a mapping between handled KeyEvents and the corresponding navigation event that
* should be fired when the KeyEvent is received.
Expand Down
Loading