-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathApp.tsx
43 lines (37 loc) · 1.04 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
import React, { useEffect } from 'react';
import { StatusBar } from 'react-native';
import TrackPlayer, { Capability } from 'react-native-track-player';
import { Provider } from 'react-redux';
import { persistStore } from 'redux-persist';
import { PersistGate } from 'redux-persist/integration/react';
import RootNavigation from './src/navigations';
import { store } from './src/store';
function App() {
const setupPlayer = async () => {
await TrackPlayer.setupPlayer();
await TrackPlayer.updateOptions({
capabilities: [Capability.Play, Capability.Pause],
});
};
useEffect(() => {
setupPlayer();
return () => {
TrackPlayer.destroy();
};
}, []);
const persistor = persistStore(store);
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<App />
<StatusBar
barStyle="light-content"
translucent
backgroundColor="transparent"
/>
<RootNavigation />
</PersistGate>
</Provider>
);
}
export default App;