Refactor to remove tertiary check for safe areas

This commit is contained in:
Alex Kim
2026-06-02 20:00:16 +10:00
parent bf061403fe
commit 076573e673
7 changed files with 43 additions and 48 deletions

View File

@@ -9,10 +9,9 @@ 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 { useControlsSafeAreaInsets } from "@/hooks/useControlsSafeAreaInsets";
import {
type ChapterEntry,
chapterStartsMs,
@@ -31,7 +30,6 @@ interface ChapterListProps {
}
const ROW_HEIGHT = 48;
const ZERO_INSETS = { top: 0, right: 0, bottom: 0, left: 0 };
function ChapterListComponent({
visible,
@@ -41,10 +39,7 @@ function ChapterListComponent({
onClose,
}: ChapterListProps) {
const { t } = useTranslation();
const { settings } = useSettings();
const insets = useSafeAreaInsets();
const safeArea =
(settings?.safeAreaInControlsEnabled ?? true) ? insets : ZERO_INSETS;
const safeArea = useControlsSafeAreaInsets();
const listRef = useRef<FlatList<ChapterEntry>>(null);
const entries = useMemo(() => sortedChapters(chapters), [chapters]);