fix: fix the controls so they don't intefere with bottom controls

This commit is contained in:
Adrian Castro
2024-02-14 21:53:33 +01:00
parent 6ebdb6820a
commit 439ba8c7e5
2 changed files with 28 additions and 27 deletions

View File

@@ -1,7 +1,6 @@
import { TouchableWithoutFeedback, View } from "react-native";
import { View } from "react-native";
import type { HeaderData } from "./Header";
import { usePlayerStore } from "~/stores/player/store";
import { BottomControls } from "./BottomControls";
import { Header } from "./Header";
import { MiddleControls } from "./MiddleControls";
@@ -11,19 +10,11 @@ interface ControlsOverlayProps {
}
export const ControlsOverlay = ({ headerData }: ControlsOverlayProps) => {
const idle = usePlayerStore((state) => state.interface.isIdle);
const setIsIdle = usePlayerStore((state) => state.setIsIdle);
const handleTouch = () => {
setIsIdle(!idle);
};
return (
<TouchableWithoutFeedback onPress={handleTouch}>
<View className="absolute left-0 top-0 flex h-full w-full flex-1">
<Header data={headerData} />
<MiddleControls />
<BottomControls />
</View>
</TouchableWithoutFeedback>
);
};

View File

@@ -1,11 +1,20 @@
import { StyleSheet, View } from "react-native";
import { StyleSheet, TouchableWithoutFeedback, View } from "react-native";
import { usePlayerStore } from "~/stores/player/store";
import { Controls } from "./Controls";
import { PlayButton } from "./PlayButton";
import { SeekButton } from "./SeekButton";
export const MiddleControls = () => {
const idle = usePlayerStore((state) => state.interface.isIdle);
const setIsIdle = usePlayerStore((state) => state.setIsIdle);
const handleTouch = () => {
setIsIdle(!idle);
};
return (
<TouchableWithoutFeedback onPress={handleTouch}>
<View style={styles.container}>
<Controls className="mr-24">
<SeekButton type="backward" />
@@ -17,6 +26,7 @@ export const MiddleControls = () => {
<SeekButton type="forward" />
</Controls>
</View>
</TouchableWithoutFeedback>
);
};