xref: /MusicFree/src/pages/musicDetail/components/background.tsx (revision 2aa881935ca35b8fb1abc4206e0dc35149231456)
1import React from 'react';
2import {Image, StyleSheet, View} from 'react-native';
3import MusicQueue from '@/core/musicQueue';
4
5export default function Background() {
6    const musicItem = MusicQueue.useCurrentMusicItem();
7    return (
8        <>
9            {musicItem?.artwork && (
10                <>
11                    <View style={style.background} />
12                    <Image
13                        style={style.blur}
14                        blurRadius={50}
15                        source={{
16                            uri: musicItem.artwork,
17                        }}
18                    />
19                </>
20            )}
21        </>
22    );
23}
24
25const style = StyleSheet.create({
26    background: {
27        width: '100%',
28        height: '100%',
29        position: 'absolute',
30        top: 0,
31        left: 0,
32        right: 0,
33        bottom: 0,
34        backgroundColor: '#000',
35    },
36    blur: {
37        width: '100%',
38        height: '100%',
39        position: 'absolute',
40        top: 0,
41        left: 0,
42        right: 0,
43        bottom: 0,
44        opacity: 0.5,
45    },
46});
47