Files
native-app/apps/expo/src/components/player/BackButton.tsx
2024-02-12 16:11:35 +01:00

30 lines
687 B
TypeScript

import { useRouter } from "expo-router";
import { Ionicons } from "@expo/vector-icons";
import { usePlayerStore } from "~/stores/player/store";
export const BackButton = ({
className,
}: Partial<React.ComponentProps<typeof Ionicons>>) => {
const unlockOrientation = usePlayerStore((state) => state.unlockOrientation);
const router = useRouter();
return (
<Ionicons
name="arrow-back"
onPress={() => {
unlockOrientation()
.then(() => {
return router.back();
})
.catch(() => {
return router.back();
});
}}
size={36}
color="white"
className={className}
/>
);
};