xref: /MusicFree/src/pages/home/components/operations/index.tsx (revision b882a19d884fffa32f7c8cef31652b909dceaa0f)
1import React from 'react';
2import {StyleSheet, View} from 'react-native';
3import rpx from '@/utils/rpx';
4import ActionButton from './ActionButton';
5import {useNavigation} from '@react-navigation/native';
6import {ROUTE_PATH} from '@/entry/router';
7
8export default function Operations() {
9    const navigation = useNavigation<any>();
10
11    const actionButtons = [
12        {
13            iconName: 'heart',
14            iconColor: 'red',
15            title: '我喜欢',
16            action() {
17                navigation.navigate(ROUTE_PATH.SHEET_DETAIL, {
18                    id: 'favorite',
19                });
20            },
21        },
22        {
23            iconName: 'folder-music-outline',
24            title: '本地音乐',
25            action() {
26                navigation.navigate(ROUTE_PATH.LOCAL);
27            },
28        },
29        // {
30        //   iconName: 'ios-time-sharp',
31        //   title: '最近播放',
32        //   action(){
33        //     console.log('最近');
34        //   }
35        // },
36        {
37            iconName: 'download',
38            title: '下载列表',
39            action() {
40                navigation.navigate(ROUTE_PATH.DOWNLOADING);
41            },
42        },
43    ];
44
45    return (
46        <View style={style.wrapper}>
47            {actionButtons.map(action => (
48                <ActionButton key={action.title} {...action} />
49            ))}
50        </View>
51    );
52}
53
54const style = StyleSheet.create({
55    wrapper: {
56        width: rpx(750),
57        flexDirection: 'row',
58        height: rpx(144),
59        justifyContent: 'space-between',
60        paddingHorizontal: rpx(24),
61        marginTop: rpx(24),
62    },
63});
64