diff --git a/components/chapters/ChapterList.tsx b/components/chapters/ChapterList.tsx index dd6ef1bd9..98d058524 100644 --- a/components/chapters/ChapterList.tsx +++ b/components/chapters/ChapterList.tsx @@ -9,8 +9,10 @@ import type { ChapterInfo } from "@jellyfin/sdk/lib/generated-client/models"; import { memo, useEffect, useMemo, useRef } from "react"; import { useTranslation } from "react-i18next"; import { FlatList, Modal, Pressable, StyleSheet, View } from "react-native"; +import { useSafeAreaInsets } from "react-native-safe-area-context"; import { Text } from "@/components/common/Text"; import { Colors } from "@/constants/Colors"; +import { useSettings } from "@/utils/atoms/settings"; import { type ChapterEntry, chapterStartsMs, @@ -29,6 +31,7 @@ interface ChapterListProps { } const ROW_HEIGHT = 48; +const ZERO_INSETS = { top: 0, right: 0, bottom: 0, left: 0 }; function ChapterListComponent({ visible, @@ -38,6 +41,10 @@ function ChapterListComponent({ onClose, }: ChapterListProps) { const { t } = useTranslation(); + const { settings } = useSettings(); + const insets = useSafeAreaInsets(); + const safeArea = + (settings?.safeAreaInControlsEnabled ?? true) ? insets : ZERO_INSETS; const listRef = useRef>(null); const entries = useMemo(() => sortedChapters(chapters), [chapters]); @@ -79,7 +86,17 @@ function ChapterListComponent({ supportedOrientations={["portrait", "landscape"]} > - e.stopPropagation()} style={styles.sheet}> + e.stopPropagation()} + style={[ + styles.sheet, + { + marginLeft: safeArea.left, + marginRight: safeArea.right, + paddingBottom: safeArea.bottom, + }, + ]} + > {t("chapters.title")} = ({ @@ -111,7 +108,6 @@ export const BottomControls: FC = ({ trickPlayUrl, trickplayInfo, time, - chapterPositions = [], }) => { const { settings } = useSettings(); const { t } = useTranslation(); @@ -188,17 +184,6 @@ export const BottomControls: FC = ({ ) : null} - {hasChapters && ( - setChapterListVisible(true)} - hitSlop={10} - className='justify-center mr-4' - accessibilityRole='button' - accessibilityLabel={t("chapters.open")} - > - - - )} = ({ onPress={handleNextEpisodeManual} /> )} + {hasChapters && ( + setChapterListVisible(true)} + hitSlop={10} + className='justify-center ml-4' + accessibilityRole='button' + accessibilityLabel={t("chapters.open")} + > + + + )} = ({ hasNextChapter, goToPreviousChapter, goToNextChapter, - chapterPositions, } = useChapterNavigation({ chapters: item.Chapters, progress, @@ -585,7 +584,6 @@ export const Controls: FC = ({ trickPlayUrl={trickPlayUrl} trickplayInfo={trickplayInfo} time={isSliding || showRemoteBubble ? time : remoteTime} - chapterPositions={chapterPositions} />