xref: /MusicFree/src/pages/musicDetail/components/background.tsx (revision bf6e62f27bf21a011995d7561e0093fae1a2d72e)
1*bf6e62f2S猫头猫import React from 'react';
2*bf6e62f2S猫头猫import {Image, StyleSheet, Text, View} from 'react-native';
3*bf6e62f2S猫头猫import rpx from '@/utils/rpx';
4*bf6e62f2S猫头猫import MusicQueue from '@/common/musicQueue';
5*bf6e62f2S猫头猫
6*bf6e62f2S猫头猫interface IBackgroundProps {}
7*bf6e62f2S猫头猫export default function Background(props: IBackgroundProps) {
8*bf6e62f2S猫头猫  const musicItem = MusicQueue.useCurrentMusicItem();
9*bf6e62f2S猫头猫  return (
10*bf6e62f2S猫头猫    <>
11*bf6e62f2S猫头猫      {musicItem?.artwork && (
12*bf6e62f2S猫头猫        <Image
13*bf6e62f2S猫头猫          style={style.blur}
14*bf6e62f2S猫头猫          blurRadius={15}
15*bf6e62f2S猫头猫          source={{
16*bf6e62f2S猫头猫            uri: musicItem.artwork,
17*bf6e62f2S猫头猫          }}></Image>
18*bf6e62f2S猫头猫      )}
19*bf6e62f2S猫头猫    </>
20*bf6e62f2S猫头猫  );
21*bf6e62f2S猫头猫}
22*bf6e62f2S猫头猫
23*bf6e62f2S猫头猫const style = StyleSheet.create({
24*bf6e62f2S猫头猫  blur: {
25*bf6e62f2S猫头猫    width: '100%',
26*bf6e62f2S猫头猫    height: '100%',
27*bf6e62f2S猫头猫    position: 'absolute',
28*bf6e62f2S猫头猫    top: 0,
29*bf6e62f2S猫头猫    left: 0,
30*bf6e62f2S猫头猫    right: 0,
31*bf6e62f2S猫头猫    bottom: 0,
32*bf6e62f2S猫头猫    opacity: 0.6,
33*bf6e62f2S猫头猫  },
34*bf6e62f2S猫头猫});
35