import { BlurView } from "expo-blur" import type { FC } from "react" import { useEffect, useRef, useState } from "react" import { Platform, Pressable, StyleSheet, TouchableOpacity, View } from "react-native" import RootSiblings from "react-native-root-siblings" import { FullWindowOverlay } from "../components/common/FullWindowOverlay" import { RotateableLoading } from "../components/common/RotateableLoading" import { PlatformActivityIndicator } from "../components/ui/loading/PlatformActivityIndicator" import { CloseCuteReIcon } from "../icons/close_cute_re" class LoadingStatic { start(): { done: () => void } start(promise: Promise): Promise start(promise?: Promise) { const siblings = new RootSiblings( siblings.destroy()} />) if (promise) { promise.finally(() => siblings.destroy()) return promise } else { return { done: () => { siblings.destroy() }, } } } } export const loading = new LoadingStatic() const LoadingContainer: FC<{ cancel: () => void }> = ({ cancel }) => { const cancelTimerRef = useRef(null) const [showCancelButton, setShowCancelButton] = useState(false) useEffect(() => { cancelTimerRef.current = setTimeout(() => { setShowCancelButton(true) }, 3000) return () => { if (cancelTimerRef.current) { clearTimeout(cancelTimerRef.current) } } }, []) return ( {/* Pressable to prevent the overlay from being clicked */} {Platform.OS === "ios" ? ( ) : ( )} {showCancelButton && ( )} ) }