fix(tvOS): Patches for udp and screens menu button handling (#1564)

This commit is contained in:
Steve Byatt
2026-05-20 14:30:40 +01:00
committed by GitHub
parent e84cea6427
commit 4bef386b82
11 changed files with 210 additions and 331 deletions

View File

@@ -28,6 +28,19 @@ export function disableTVMenuKeyInterception() {
}
}
export function useTVMenuKeyInterception(enabled = true) {
useEffect(() => {
if (!Platform.isTV) return;
if (enabled) {
enableTVMenuKeyInterception();
return;
}
disableTVMenuKeyInterception();
}, [enabled]);
}
/**
* Subscribe to TV back presses through React Native's BackHandler.
*
@@ -52,6 +65,8 @@ export function useTVBackPress(
handler,
);
return () => subscription.remove();
return () => {
subscription.remove();
};
}, deps);
}