import { runtimeTicksToMinutes } from "@/utils/time"; import { useActionSheet } from "@expo/react-native-action-sheet"; import { Feather, Ionicons } from "@expo/vector-icons"; import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models"; import { View } from "react-native"; import { Button } from "./Button"; interface Props extends React.ComponentProps { item: BaseItemDto; onPress: (type?: "cast" | "device") => void; chromecastReady: boolean; } export const PlayButton: React.FC = ({ item, onPress, chromecastReady, ...props }) => { const { showActionSheetWithOptions } = useActionSheet(); const _onPress = () => { if (!chromecastReady) { onPress("device"); return; } const options = ["Chromecast", "Device", "Cancel"]; const cancelButtonIndex = 2; showActionSheetWithOptions( { options, cancelButtonIndex, }, (selectedIndex: number | undefined) => { switch (selectedIndex) { case 0: onPress("cast"); break; case 1: onPress("device"); break; case cancelButtonIndex: break; } }, ); }; return ( ); };