import 'react-native-gesture-handler';
import { useEffect } from 'react';
import type { ReactElement } from 'react';
import { ActivityIndicator, View } from 'react-native';
import { Stack } from 'expo-router';
import { StatusBar } from 'expo-status-bar';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { KeyboardProvider } from 'react-native-keyboard-controller';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { setAudioModeAsync } from 'expo-audio';
import { ThemeProvider, useTheme } from '@/theme';
import { useSession } from '@/stores/session';
import { ErrorBoundary } from '@/components';
// Voice notes must play even with the iPhone mute switch on (Telegram
// behavior) — without this, playback "works" but is silent on most devices.
void setAudioModeAsync({ playsInSilentMode: true });
const RootNavigator = (): ReactElement => {
const { colors, name } = useTheme();
const status = useSession((s) => s.status);
const bootstrap = useSession((s) => s.bootstrap);
useEffect(() => {
void bootstrap();
}, [bootstrap]);
if (status === 'loading') {
return (
);
}
return (
<>
>
);
};
export default function RootLayout(): ReactElement {
return (
);
}