xref: /MusicFree/src/pages/localMusic/index.tsx (revision b882a19d884fffa32f7c8cef31652b909dceaa0f)
1import React from 'react';
2import {StyleSheet} from 'react-native';
3import rpx from '@/utils/rpx';
4import {useNavigation, useTheme} from '@react-navigation/native';
5import {Appbar} from 'react-native-paper';
6import ThemeText from '@/components/base/themeText';
7import {SafeAreaView} from 'react-native-safe-area-context';
8import StatusBar from '@/components/base/statusBar';
9import LocalMusicList from './localMusicList';
10import MusicBar from '@/components/musicBar';
11import {useEffect} from 'react';
12import Download from '@/core/download';
13
14export default function LocalMusic() {
15    const navigation = useNavigation();
16
17    const {colors} = useTheme();
18
19    useEffect(() => {
20        Download.setup();
21    }, []);
22
23    return (
24        <SafeAreaView style={style.wrapper}>
25            <StatusBar />
26            <Appbar style={[style.appbar, {backgroundColor: colors.primary}]}>
27                <Appbar.BackAction
28                    color={colors.text}
29                    onPress={() => {
30                        navigation.goBack();
31                    }}
32                />
33                <Appbar.Header style={style.header}>
34                    <ThemeText
35                        style={style.header}
36                        fontSize="title"
37                        fontWeight="semibold">
38                        本地音乐
39                    </ThemeText>
40                </Appbar.Header>
41            </Appbar>
42            <LocalMusicList />
43            <MusicBar />
44        </SafeAreaView>
45    );
46}
47
48const style = StyleSheet.create({
49    wrapper: {
50        width: rpx(750),
51        flex: 1,
52    },
53    appbar: {
54        shadowColor: 'transparent',
55        backgroundColor: '#2b333eaa',
56    },
57    header: {
58        backgroundColor: 'transparent',
59        shadowColor: 'transparent',
60    },
61});
62