xref: /MusicFree/src/components/base/pageBackground.tsx (revision a27adc201796bd0be4a6a41893461b099d480a34)
1bb9b2f7bS猫头猫import React, {memo} from 'react';
219dc08ecS猫头猫import {StyleSheet, View} from 'react-native';
319dc08ecS猫头猫import Image from './image';
4e650bfb3S猫头猫import useColors from '@/hooks/useColors';
5*a27adc20S猫头猫import Theme from '@/core/theme';
619dc08ecS猫头猫
7bb9b2f7bS猫头猫function PageBackground() {
8*a27adc20S猫头猫    const theme = Theme.useTheme();
9*a27adc20S猫头猫    const background = Theme.useBackground();
10e650bfb3S猫头猫    const colors = useColors();
1119dc08ecS猫头猫
1219dc08ecS猫头猫    return (
1319dc08ecS猫头猫        <>
1419dc08ecS猫头猫            <View
1519dc08ecS猫头猫                style={[
1619dc08ecS猫头猫                    style.wrapper,
1719dc08ecS猫头猫                    {
1819dc08ecS猫头猫                        backgroundColor:
19e650bfb3S猫头猫                            colors?.pageBackground ?? colors.background,
2019dc08ecS猫头猫                    },
214060c00aS猫头猫                ]}
224060c00aS猫头猫            />
23*a27adc20S猫头猫            {!theme.id.startsWith('p-') && background?.url ? (
2419dc08ecS猫头猫                <Image
25*a27adc20S猫头猫                    uri={background.url}
2619dc08ecS猫头猫                    style={[
2719dc08ecS猫头猫                        style.wrapper,
2819dc08ecS猫头猫                        {
29*a27adc20S猫头猫                            opacity: background?.opacity ?? 0.6,
3019dc08ecS猫头猫                        },
3119dc08ecS猫头猫                    ]}
32*a27adc20S猫头猫                    blurRadius={background?.blur ?? 20}
334060c00aS猫头猫                />
341119c2eaS猫头猫            ) : null}
3519dc08ecS猫头猫        </>
3619dc08ecS猫头猫    );
3719dc08ecS猫头猫}
38bb9b2f7bS猫头猫export default memo(PageBackground, () => true);
3919dc08ecS猫头猫
4019dc08ecS猫头猫const style = StyleSheet.create({
4119dc08ecS猫头猫    wrapper: {
4219dc08ecS猫头猫        position: 'absolute',
4319dc08ecS猫头猫        top: 0,
4419dc08ecS猫头猫        left: 0,
4519dc08ecS猫头猫        right: 0,
4619dc08ecS猫头猫        bottom: 0,
4719dc08ecS猫头猫        width: '100%',
4819dc08ecS猫头猫        height: '100%',
4919dc08ecS猫头猫    },
5019dc08ecS猫头猫});
51