fix(mobile): defer crypto backend init into AppBootstrap (prevents white-screen)

This commit is contained in:
byGalax
2026-05-16 16:25:10 +02:00
parent cb46483f5d
commit 830dac4cdd
+16 -17
View File
@@ -1,34 +1,33 @@
import { crypto } from '@chat-app/shared';
import { Stack } from 'expo-router'; import { Stack } from 'expo-router';
import { StatusBar } from 'expo-status-bar'; import { StatusBar } from 'expo-status-bar';
import { GestureHandlerRootView } from 'react-native-gesture-handler'; import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { SafeAreaProvider } from 'react-native-safe-area-context'; import { SafeAreaProvider } from 'react-native-safe-area-context';
import { AppBootstrap } from '../components/AppBootstrap';
import { ErrorBoundary } from '../components/ErrorBoundary'; import { ErrorBoundary } from '../components/ErrorBoundary';
import { IncomingCallModal } from '../components/IncomingCallModal'; import { IncomingCallModal } from '../components/IncomingCallModal';
import { AuthProvider } from '../lib/authContext'; import { AuthProvider } from '../lib/authContext';
import { CallProvider } from '../lib/callContext'; import { CallProvider } from '../lib/callContext';
import { createLibsodiumBackend } from '../lib/cryptoBackend';
crypto.setCryptoBackend(createLibsodiumBackend());
export default function RootLayout() { export default function RootLayout() {
return ( return (
<GestureHandlerRootView style={{ flex: 1 }}> <GestureHandlerRootView style={{ flex: 1 }}>
<SafeAreaProvider> <SafeAreaProvider>
<ErrorBoundary> <AppBootstrap>
<AuthProvider> <ErrorBoundary>
<CallProvider> <AuthProvider>
<StatusBar style="auto" /> <CallProvider>
<Stack screenOptions={{ headerShown: false }}> <StatusBar style="auto" />
<Stack.Screen name="index" /> <Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="(app)" /> <Stack.Screen name="index" />
<Stack.Screen name="auth/callback" /> <Stack.Screen name="(app)" />
</Stack> <Stack.Screen name="auth/callback" />
<IncomingCallModal /> </Stack>
</CallProvider> <IncomingCallModal />
</AuthProvider> </CallProvider>
</ErrorBoundary> </AuthProvider>
</ErrorBoundary>
</AppBootstrap>
</SafeAreaProvider> </SafeAreaProvider>
</GestureHandlerRootView> </GestureHandlerRootView>
); );