-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
41 lines (38 loc) · 1.28 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
import { StatusBar } from 'expo-status-bar';
import React, { useState } from 'react';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import useCachedResources from './Hooks/useCachedResources';
import useColorScheme from './Hooks/useColorScheme';
import Navigation from './navigation/Navigation';
import PlayerWidgets from './components/PlayerWidget/PlayerWidget';
import { Provider } from 'react-redux';
import { store } from './reducer/store';
import { AppContext } from './AppContext';
function App() {
const [songId, setSongId] = useState<number | null>(null);
const [imageId, setImageId] = useState<string | null>(null);
const isLoadingComplete = useCachedResources();
const colorScheme = useColorScheme();
if (!isLoadingComplete) {
return null;
} else {
return (
<SafeAreaProvider>
<AppContext.Provider
value={{
songId,
imageId,
setSongId: (id: number) => setSongId(id),
setImageId: (image: string) => setImageId(image),
}}>
<Provider store={store}>
<Navigation colorScheme={colorScheme} />
<StatusBar />
<PlayerWidgets />
</Provider>
</AppContext.Provider>
</SafeAreaProvider>
);
}
}
export default App;