import { DarkTheme, Stack, ThemeProvider } from "expo-router"; import { StatusBar } from "expo-status-bar"; import { useEffect, useState } from "react"; import { View } from "react-native"; import { GestureHandlerRootView } from "react-native-gesture-handler"; import { KeyboardProvider } from "react-native-keyboard-controller"; import { AvatarStyleProvider } from "../components/avatar-style"; import { currentApiBase, loadApiBase, loadSessionToken, selectedSpaceId } from "../lib/api"; import { configureForegroundNotifications, resumeLiveNotifications, } from "../lib/live-notifications"; import { applyMobileUiDirection } from "../lib/ui-direction"; applyMobileUiDirection(); configureForegroundNotifications(); export default function Layout() { const [ready, setReady] = useState(false); useEffect(() => { void loadApiBase() .then(async () => resumeLiveNotifications( currentApiBase(), await loadSessionToken(), selectedSpaceId() ?? "", ), ) .catch(() => undefined) .finally(() => setReady(true)); }, []); return ( {ready ? ( ) : ( )} ); }