Gamepad overview
Vega supports gamepad devices for both navigation and game controls in React Native for Vega apps. Gamepads can trigger:- Key events (For example, pressing A, B, or triggers)
- Axis events (For example., moving thumbsticks or the D-Pad)
- Primary events are the raw, gamepad-specific inputs such as thumbstick movement or key presses.
- Secondary events are the high-level TV navigation events such as
select,back,up,downthat are mapped to gamepad inputs where appropriate.
Input events
Ideally, all gamepads can support multiple input events for a particular key or axis action. For instance, pressing the action button ‘A’ on the gamepad produces a primary event ofaction_btn_a and a secondary event of select, if the app is subscribed to it. This is useful when an app wants to perform navigation or item selection on the screen using a gamepad instead of a TV remote, as the secondary events provide those capabilities.
Vega provides a dedicated hook called useKeplerBackHandler for handling custom back event logic, which doesn’t handle events through useTVEventHandler or TVEventHandler. By default, useKeplerBackHandler returns false if the app hasn’t subscribed to it, meaning that whenever a back button is pressed the system acknowledges it to navigate to previous window. If this behavior is not appropriate for the app or you need to handle the logic from the JavaScript layer, then a subscription must be added through useKeplerBackHandler, and the handler should return true along with any custom logic.
Gamepad input events mapping
Usage Reference
Subscribing to primary/default events
An app can add a subscription to primary events by registering throughuseGamepadEventHandler. This hook takes a handler method as an argument and returns a GamepadEventSubscription object. The GamepadEventSubscription.enabled property returns a boolean indicating whether the current handler is internally enabled if true and disabled if false. An app can control the subscription to primary events using GamepadEventSubscription.setEnabled. Pass true to enable the hook or false to disable it.
The useGamepadEventHandler hook has the following declaration which is exposed to JS layer.
useGamepadEventHandler hook.
useGamepadEventHandler hook in an app.
TVEventHandler.
Related topics
TVEventHandler: UseuseTVEventHandlerto subscribe to high-level navigation events such asup,down, andselectetc.useKeplerBackHandler: Handle back-button events with custom logic from the JavaScript layer.

