xref: /MusicFree/src/components/base/pageBackground.tsx (revision 6704747af84cebd842b258efac7143542722fac5)
1import React from 'react';
2import {StyleSheet, View} from 'react-native';
3import Config from '@/core/config';
4import {useTheme} from 'react-native-paper';
5import {ImgAsset} from '@/constants/assetsConst';
6import Image from './image';
7
8export default function PageBackground() {
9  const themeConfig = Config.useConfig('setting.theme');
10  const theme = useTheme();
11
12  return (
13    <>
14      <View
15        style={[
16          style.wrapper,
17          {
18            backgroundColor:
19              theme.colors?.pageBackground ?? theme.colors.background,
20          },
21        ]}></View>
22      <Image
23        uri={themeConfig?.background}
24        emptySrc={ImgAsset.backgroundDefault}
25        style={[
26          style.wrapper,
27          {
28            opacity: themeConfig?.backgroundOpacity ?? 0.7,
29          },
30        ]}
31        blurRadius={themeConfig?.backgroundBlur ?? 20}></Image>
32    </>
33  );
34}
35
36const style = StyleSheet.create({
37  wrapper: {
38    position: 'absolute',
39    top: 0,
40    left: 0,
41    right: 0,
42    bottom: 0,
43    width: '100%',
44    height: '100%',
45  },
46});
47