mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 14:53:24 +00:00
add back button and header layout to player
This commit is contained in:
29
apps/expo/src/components/player/BackButton.tsx
Normal file
29
apps/expo/src/components/player/BackButton.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import { useRouter } from "expo-router";
|
||||
import { Ionicons } from "@expo/vector-icons";
|
||||
|
||||
import { usePlayer } from "~/context/player.context";
|
||||
|
||||
export const BackButton = ({
|
||||
className,
|
||||
}: Partial<React.ComponentProps<typeof Ionicons>>) => {
|
||||
const { unlockOrientation } = usePlayer();
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<Ionicons
|
||||
name="arrow-back"
|
||||
onPress={() => {
|
||||
unlockOrientation()
|
||||
.then(() => {
|
||||
return router.back();
|
||||
})
|
||||
.catch(() => {
|
||||
return router.back();
|
||||
});
|
||||
}}
|
||||
size={36}
|
||||
color="white"
|
||||
className={className}
|
||||
/>
|
||||
);
|
||||
};
|
Reference in New Issue
Block a user