mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-07-05 12:02:55 +01:00
fix: handle TV menu and back navigation (#1559)
This commit is contained in:
17
hooks/useTVEventHandler.ts
Normal file
17
hooks/useTVEventHandler.ts
Normal 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;
|
||||
Reference in New Issue
Block a user