Skip to content

Commit

Permalink
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/screens/anime/watch/components/media-settings.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import type { BottomSheetModal } from '@gorhom/bottom-sheet';
import { useSetAtom } from 'jotai/react';
import { SettingsIcon } from 'lucide-react-native';
import React, { useRef } from 'react';

import { View } from '@/ui';
import colors from '@/ui/theme/colors';

import { pausedAtom } from '../store';
import MediaPlayBackSettings from './media-playback-settings';
import MediaQualitySettings from './media-quality-settings';
import MediaSubtitleSettings from './media-subtitle-settings';
@@ -13,12 +15,15 @@ import Tappable from './tappable';

const MediaSettings = () => {
const bottomSheetRef = useRef<BottomSheetModal>(null);
const setPaused = useSetAtom(pausedAtom);

return (
<View>
<Tappable
onPress={() => {
bottomSheetRef.current?.present();

setPaused(true);
}}
>
<View className="ml-auto bg-transparent p-0">
11 changes: 9 additions & 2 deletions src/screens/anime/watch/components/settings-bottom-sheet.tsx
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import {
type BottomSheetModal,
useBottomSheetModal,
} from '@gorhom/bottom-sheet';
import { useSetAtom } from 'jotai/react';
import { ChevronLeft } from 'lucide-react-native';
import React, { useCallback } from 'react';

@@ -12,6 +13,7 @@ import type { BottomSheetProps } from '@/ui/core/bottom-sheet';
import BottomSheet from '@/ui/core/bottom-sheet';

import useScreenSize from '../hooks/use-screen-size';
import { pausedAtom } from '../store';

type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;

@@ -34,6 +36,8 @@ const SettingsBottomSheet = React.forwardRef<
},
ref
) => {
const setPaused = useSetAtom(pausedAtom);

const screenSize = useScreenSize();
const { dismiss, dismissAll } = useBottomSheetModal();

@@ -45,10 +49,13 @@ const SettingsBottomSheet = React.forwardRef<
pressBehavior="collapse"
opacity={0.6}
disappearsOnIndex={-1}
onPress={dismissAll}
onPress={() => {
dismissAll();
setPaused(false);
}}
/>
),
[dismissAll]
[dismissAll, setPaused]
);

return (

0 comments on commit 07ebc2d

Please sign in to comment.