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