mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 18:13:25 +00:00
fix: player controls touch events on iOS
This commit is contained in:
@@ -9,15 +9,9 @@ interface ControlsProps extends React.ComponentProps<typeof TouchableOpacity> {
|
|||||||
|
|
||||||
export const Controls = ({ children, className }: ControlsProps) => {
|
export const Controls = ({ children, className }: ControlsProps) => {
|
||||||
const idle = usePlayerStore((state) => state.interface.isIdle);
|
const idle = usePlayerStore((state) => state.interface.isIdle);
|
||||||
const setIsIdle = usePlayerStore((state) => state.setIsIdle);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity
|
<TouchableOpacity className={className}>
|
||||||
onPress={() => {
|
|
||||||
setIsIdle(false);
|
|
||||||
}}
|
|
||||||
className={className}
|
|
||||||
>
|
|
||||||
{!idle && children}
|
{!idle && children}
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
|
@@ -1,21 +1,31 @@
|
|||||||
import { View } from "react-native";
|
import { TouchableWithoutFeedback, View } from "react-native";
|
||||||
|
|
||||||
|
import { usePlayerStore } from "~/stores/player/store";
|
||||||
import { Controls } from "./Controls";
|
import { Controls } from "./Controls";
|
||||||
import { PlayButton } from "./PlayButton";
|
import { PlayButton } from "./PlayButton";
|
||||||
import { SeekButton } from "./SeekButton";
|
import { SeekButton } from "./SeekButton";
|
||||||
|
|
||||||
export const MiddleControls = () => {
|
export const MiddleControls = () => {
|
||||||
|
const idle = usePlayerStore((state) => state.interface.isIdle);
|
||||||
|
const setIsIdle = usePlayerStore((state) => state.setIsIdle);
|
||||||
|
|
||||||
|
const handleTouch = () => {
|
||||||
|
setIsIdle(!idle);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className="absolute flex h-full w-full flex-1 flex-row items-center justify-center gap-24">
|
<TouchableWithoutFeedback onPress={handleTouch}>
|
||||||
<Controls>
|
<View className="absolute flex h-full w-full flex-1 flex-row items-center justify-center gap-24">
|
||||||
<SeekButton type="backward" />
|
<Controls>
|
||||||
</Controls>
|
<SeekButton type="backward" />
|
||||||
<Controls>
|
</Controls>
|
||||||
<PlayButton />
|
<Controls>
|
||||||
</Controls>
|
<PlayButton />
|
||||||
<Controls>
|
</Controls>
|
||||||
<SeekButton type="forward" />
|
<Controls>
|
||||||
</Controls>
|
<SeekButton type="forward" />
|
||||||
</View>
|
</Controls>
|
||||||
|
</View>
|
||||||
|
</TouchableWithoutFeedback>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user