generated from jacket-sikaha/react-native-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
44 lines (40 loc) · 1.22 KB
/
App.tsx
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
import {createDrawerNavigator} from '@react-navigation/drawer';
import {NavigationContainer} from '@react-navigation/native';
import React from 'react';
import {QueryClient, QueryClientProvider} from 'react-query';
import './gesture-handler.js';
import {menuList} from './utils/menuData';
import {Image} from 'react-native';
// react-native-reanimated 3.15.1最新版本貌似有问题,降级3.10目前能运行
const Drawer = createDrawerNavigator();
// 创建一个 client
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
},
},
});
function App(): React.JSX.Element {
return (
<QueryClientProvider client={queryClient}>
<NavigationContainer>
<Drawer.Navigator>
{menuList.map(({element, name, icon}, i) => (
<Drawer.Screen
options={{
drawerIcon: ({color, size, focused}) => (
<Image source={{uri: icon}} className="w-8 h-8" />
),
}}
key={name}
name={name}
component={element}
/>
))}
</Drawer.Navigator>
</NavigationContainer>
</QueryClientProvider>
);
}
export default App;