forked from masqomar21/finally
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
54 lines (48 loc) · 1.61 KB
/
App.js
File metadata and controls
54 lines (48 loc) · 1.61 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
/* eslint-disable import/no-unresolved */
import axios from 'axios';
import { BASE_URL } from '@env';
import { useCallback } from 'react';
import { useFonts } from 'expo-font';
import { Provider } from 'react-redux';
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, View } from 'react-native';
import * as SplashScreen from 'expo-splash-screen';
import './src/socket';
import './src/runtime';
import store from './src/redux/store';
import { events } from './src/helpers';
import Navigator from './src/Navigator';
// Set axios configs.
axios.defaults.baseURL = BASE_URL || 'http://103.37.124.129';
SplashScreen.preventAutoHideAsync();
function App() {
// State.
// Load fonts.
const [fontsLoaded] = useFonts({
'Urbanist-Medium': require('./src/assets/fonts/Urbanist/Urbanist-Medium.ttf'),
'Urbanist-Bold': require('./src/assets/fonts/Urbanist/Urbanist-Bold.ttf'),
'Poppins-Regular': require('./src/assets/fonts/Poppins/Poppins-Regular.ttf'),
'Poppins-Medium': require('./src/assets/fonts/Poppins/Poppins-Medium.ttf'),
'Poppins-Bold': require('./src/assets/fonts/Poppins/Poppins-Bold.ttf'),
});
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded) await SplashScreen.hideAsync();
events.emit('app-ready');
}, [fontsLoaded]);
if (!fontsLoaded) return null;
// Render screen.
return (
<Provider store={store}>
<View style={style.container} onLayout={onLayoutRootView}>
<StatusBar style="auto" />
<Navigator />
</View>
</Provider>
);
}
const style = StyleSheet.create({
container: {
flex: 1,
},
});
export default App;