useTVEventHandler

React Hook for subscribing to TV remote events.

useTVEventHandler provides a declarative wrapper around TVEventHandler.addListener. The subscription is created on mount and removed automatically on unmount.

import { useTVEventHandler } from 'react-native';

function Screen() {
useTVEventHandler((event) => {
if (event.eventType === 'left') {
// handle left navigation intent
}
});

return null;
}

API

Arguments

handler (event: TVRemoteEvent) => void

Callback that receives each TV remote event emitted by the runtime.

Returns

This hook does not return a value.


Updated
React Native Web for TVPortions Copyright © Nicolas Gallagher, Meta Platforms, Inc., Facebook, Inc. and affiliates, and other contributors as noted in file headers and THIRD_PARTY_NOTICES.md. Modifications and TV extensions Copyright © Harpreet Singh and contributors.