-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
94 lines (88 loc) · 2.65 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import {useEffect, useMemo} from 'react';
import TrackPlayer, {
AppKilledPlaybackBehavior,
Capability,
RepeatMode,
} from 'react-native-track-player';
import Navigation from './routes/';
import PlayerProvider from './context/PlayerProvider';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
import AuthProvider from './context/AuthProvider';
import Toast from './components/toast/Toast';
import React from 'react';
import {BottomSheetModalProvider} from '@gorhom/bottom-sheet';
export default function App() {
// const colorScheme = useThemeStore(state =>
// state.COLOR.isDark ? 'dark' : 'light',
// );
// const {theme, updateTheme} = useMaterial3Theme();
// const paperTheme = useMemo(
// () =>
// colorScheme === 'dark'
// ? {...MD3DarkTheme, colors: theme.dark}
// : {...MD3LightTheme, colors: theme.light},
// [colorScheme, theme, color.dominant!],
// );
useEffect(() => {
const setupPlayer = async () => {
try {
await TrackPlayer.setupPlayer({
autoHandleInterruptions: true,
maxCacheSize: 1024 * 512,
autoUpdateMetadata: false,
});
await TrackPlayer.setRepeatMode(RepeatMode.Queue);
await TrackPlayer.setVolume(1);
await TrackPlayer.updateOptions({
progressUpdateEventInterval: 1,
capabilities: [
Capability.Play,
Capability.Pause,
Capability.SkipToNext,
Capability.SkipToPrevious,
Capability.SeekTo,
],
compactCapabilities: [
Capability.Play,
Capability.Pause,
Capability.SkipToNext,
Capability.SkipToPrevious,
],
notificationCapabilities: [
Capability.Play,
Capability.Pause,
Capability.SkipToNext,
Capability.SkipToPrevious,
Capability.SeekTo,
],
android: {
appKilledPlaybackBehavior:
AppKilledPlaybackBehavior.ContinuePlayback,
alwaysPauseOnInterruption: true,
},
color: 0x0098db,
});
} catch (e) {
console.log(e);
}
};
setupPlayer();
}, []);
// useEffect(() => {
// updateTheme(color.dominant!);
// }, [color.dominant!]);
return (
<AuthProvider>
{/* <PaperProvider theme={paperTheme}> */}
<PlayerProvider>
<GestureHandlerRootView>
<BottomSheetModalProvider>
<Navigation />
</BottomSheetModalProvider>
<Toast />
</GestureHandlerRootView>
</PlayerProvider>
{/* </PaperProvider> */}
</AuthProvider>
);
}