fix: handle TV menu and back navigation (#1559)

This commit is contained in:
Steve Byatt
2026-05-20 08:57:19 +01:00
committed by GitHub
parent 92deba14f3
commit ca4f24ded0
6 changed files with 123 additions and 189 deletions

View File

@@ -0,0 +1,17 @@
import type { HWEvent } from "react-native";
import { Platform } from "react-native";
type UseTVEventHandler = (callback: (evt: HWEvent) => void) => void;
let tvEventHandler: UseTVEventHandler = () => {};
if (Platform.isTV) {
try {
tvEventHandler = require("react-native")
.useTVEventHandler as UseTVEventHandler;
} catch {
tvEventHandler = () => {};
}
}
export const useTVEventHandler = tvEventHandler;