refactor(settings): restore expo-ui bottom sheet and direct clipboard (drop stale-build workarounds)

This commit is contained in:
Gauvain
2026-06-04 00:36:44 +02:00
parent 059c8bb854
commit da47ad0502
4 changed files with 36 additions and 35 deletions

View File

@@ -1,9 +1,3 @@
import {
BottomSheetBackdrop,
type BottomSheetBackdropProps,
BottomSheetModal,
BottomSheetView,
} from "@gorhom/bottom-sheet";
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api";
import { useAtom } from "jotai";
import {
@@ -18,6 +12,11 @@ import { useTranslation } from "react-i18next";
import { Alert, Platform, View } from "react-native";
import { useHaptic } from "@/hooks/useHaptic";
import { apiAtom, userAtom } from "@/providers/JellyfinProvider";
import {
type BottomSheetMethods,
BottomSheetModal,
BottomSheetView,
} from "@/utils/expoUiBottomSheet";
import { Button } from "../Button";
import { Text } from "../common/Text";
import { PinInput } from "../inputs/PinInput";
@@ -30,7 +29,7 @@ export const QuickConnectSheet = forwardRef<QuickConnectSheetRef>(
const [api] = useAtom(apiAtom);
const [user] = useAtom(userAtom);
const [quickConnectCode, setQuickConnectCode] = useState<string>();
const modalRef = useRef<BottomSheetModal>(null);
const modalRef = useRef<BottomSheetMethods>(null);
const successHapticFeedback = useHaptic("success");
const errorHapticFeedback = useHaptic("error");
const snapPoints = useMemo(
@@ -51,17 +50,6 @@ export const QuickConnectSheet = forwardRef<QuickConnectSheetRef>(
[],
);
const renderBackdrop = useCallback(
(props: BottomSheetBackdropProps) => (
<BottomSheetBackdrop
{...props}
disappearsOnIndex={-1}
appearsOnIndex={0}
/>
),
[],
);
const authorizeQuickConnect = useCallback(async () => {
if (!quickConnectCode) return;
try {
@@ -76,7 +64,7 @@ export const QuickConnectSheet = forwardRef<QuickConnectSheetRef>(
t("home.settings.quick_connect.quick_connect_autorized"),
);
setQuickConnectCode(undefined);
modalRef.current?.dismiss();
modalRef.current?.close();
} else {
errorHapticFeedback();
Alert.alert(
@@ -105,14 +93,12 @@ export const QuickConnectSheet = forwardRef<QuickConnectSheetRef>(
return (
<BottomSheetModal
ref={modalRef}
enablePanDownToClose
snapPoints={snapPoints}
handleIndicatorStyle={{ backgroundColor: "white" }}
backgroundStyle={{ backgroundColor: "#171717" }}
backdropComponent={renderBackdrop}
keyboardBehavior={isAndroid ? "fillParent" : "interactive"}
keyboardBlurBehavior='restore'
android_keyboardInputMode='adjustResize'
topInset={isAndroid ? 0 : undefined}
>
<BottomSheetView>
<View className='flex flex-col space-y-4 px-4 pb-8 pt-2'>