-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
52 lines (46 loc) · 1.35 KB
/
App.js
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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {NavigationContainer} from '@react-navigation/native';
import React from 'react';
import Config from 'react-native-config';
import {createClient, Provider} from 'urql';
import CommunityScreen from './src/screens/Community';
import HomeScreen from './src/screens/Home';
import TreasureScreen from './src/screens/Treasure';
import UrqlTestScreen from './src/screens/UrqlTest';
const Tab = createBottomTabNavigator();
const client = createClient({
url: 'https://api.github.com/graphql',
fetchOptions: () => {
const token = Config.REACT_APP_GITHUB_AUTH_TOKEN;
return {
headers: {authorization: token ? `Bearer ${token}` : ''},
};
},
});
const App = () => {
return (
<NavigationContainer>
<Tab.Navigator>
<Tab.Screen name="Home" component={HomeScreen} />
<Tab.Screen name="Community" component={CommunityScreen} />
<Tab.Screen name="Treasure" component={TreasureScreen} />
<Tab.Screen name="UrqlTest" component={UrqlTestScreen} />
</Tab.Navigator>
</NavigationContainer>
);
};
const AppRoot = () => {
return (
<Provider value={client}>
<App />
</Provider>
);
};
export default AppRoot;