forked from farshed/SoundSpice-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
executable file
·32 lines (28 loc) · 1002 Bytes
/
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
import React, { useState, useEffect } from 'react';
import { Text } from 'react-native';
import { Provider } from 'react-redux';
import { store, persistor } from './src/store';
import { PersistGate } from 'redux-persist/integration/react';
import RootNavigator from './src/navigation';
import SplashScreen from './src/screens/SplashScreen';
export default function App() {
const [timePassed, setTimePassed] = useState(false);
useEffect(() => {
setTimeout(() => setTimePassed(true), 600);
store.dispatch({ type: 'set_playback', payload: false }); // To make sure currentTrack is paused at startup
if (Text.defaultProps == null) Text.defaultProps = {};
Text.defaultProps.allowFontScaling = false;
// console.disableYellowBox = true;
}, []);
function renderApp(isReady) {
if (isReady && timePassed) {
return <RootNavigator />;
}
return <SplashScreen />;
}
return (
<Provider store={store}>
<PersistGate persistor={persistor}>{renderApp}</PersistGate>
</Provider>
);
}