mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-03 04:28:31 +01:00
Refactor to remove tertiary check for safe areas
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user