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