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.