-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
69 lines (61 loc) · 2.25 KB
/
App.js
File metadata and controls
69 lines (61 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import 'react-native-gesture-handler';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { NavigationContainer } from '@react-navigation/native';
import { createDrawerNavigator } from '@react-navigation/drawer';
import { Provider as PaperProvider } from 'react-native-paper';
import React, { useEffect, useState } from 'react';
import store from './utils/storeinfo';
import ChatsDrawer from './components/Inicio/drawer';
import HomeScreen from './screens/HomeScreen';
import ChatScreen from './screens/ChatScreen';
import OnboardingScreen from './screens/FirstUse';
import AjustesLLM from './screens/Settings';
import { checkModelExists } from './utils/downloadModel';
const Drawer = createDrawerNavigator();
export default function App() {
const [hasModel, setHasModel] = useState(null);
useEffect(() => {
(async () => {
await store.initStore?.();
try {
const exists = await checkModelExists();
setHasModel(exists);
console.log('Modelo existe:', exists);
} catch (e) {
console.warn('Error checking model:', e);
setHasModel(false);
}
})();
}, []);
if (hasModel === null) return null;
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<PaperProvider>
<NavigationContainer>
<Drawer.Navigator
screenOptions={{
headerShown: false,
drawerType: 'slide',
drawerPosition: 'left',
swipeEdgeWidth: 60,
drawerStyle: { width: 280, backgroundColor: '#2b2b2b' },
sceneContainerStyle: { backgroundColor: '#232323' },
}}
drawerContent={(props) => <ChatsDrawer {...props} />}
>
<Drawer.Screen name="Home" component={HomeScreen} />
<Drawer.Screen name="Chat" component={ChatScreen} />
<Drawer.Screen name="Ajustes LLM" component={AjustesLLM} />
{!hasModel && (
<Drawer.Screen
name="Onboarding"
component={OnboardingScreen}
options={{ drawerItemStyle: { display: 'none' } }}
/>
)}
</Drawer.Navigator>
</NavigationContainer>
</PaperProvider>
</GestureHandlerRootView>
);
}