mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
28 lines
710 B
TypeScript
28 lines
710 B
TypeScript
// hooks/useNavigationBarVisibility.ts
|
|
|
|
import { useEffect } from "react";
|
|
import { Platform } from "react-native";
|
|
import * as NavigationBar from "expo-navigation-bar";
|
|
|
|
export const useNavigationBarVisibility = (isPlaying: boolean | null) => {
|
|
useEffect(() => {
|
|
const handleVisibility = async () => {
|
|
if (Platform.OS === "android") {
|
|
if (isPlaying) {
|
|
await NavigationBar.setVisibilityAsync("hidden");
|
|
} else {
|
|
await NavigationBar.setVisibilityAsync("visible");
|
|
}
|
|
}
|
|
};
|
|
|
|
handleVisibility();
|
|
|
|
return () => {
|
|
if (Platform.OS === "android") {
|
|
NavigationBar.setVisibilityAsync("visible");
|
|
}
|
|
};
|
|
}, [isPlaying]);
|
|
};
|