xref: /MusicFree/src/components/base/loading.tsx (revision 806b27640bb516a8f62fbc5eeec7e25b9105dd8f)
119dc08ecS猫头猫import React from 'react';
219dc08ecS猫头猫import {StyleSheet, View} from 'react-native';
319dc08ecS猫头猫import rpx from '@/utils/rpx';
419dc08ecS猫头猫import {ActivityIndicator, useTheme} from 'react-native-paper';
519dc08ecS猫头猫import ThemeText from './themeText';
619dc08ecS猫头猫
7*806b2764S猫头猫interface ILoadingProps {
8*806b2764S猫头猫    text?: string;
9*806b2764S猫头猫}
10*806b2764S猫头猫export default function Loading(props: ILoadingProps) {
1119dc08ecS猫头猫    const {colors} = useTheme();
1219dc08ecS猫头猫
1319dc08ecS猫头猫    return (
1419dc08ecS猫头猫        <View style={style.wrapper}>
154060c00aS猫头猫            <ActivityIndicator animating color={colors.text} />
164060c00aS猫头猫            <ThemeText
174060c00aS猫头猫                fontSize="title"
184060c00aS猫头猫                fontWeight="semibold"
194060c00aS猫头猫                style={style.text}>
20*806b2764S猫头猫                {props?.text ?? '加载中...'}
214060c00aS猫头猫            </ThemeText>
2219dc08ecS猫头猫        </View>
2319dc08ecS猫头猫    );
2419dc08ecS猫头猫}
2519dc08ecS猫头猫
2619dc08ecS猫头猫const style = StyleSheet.create({
2719dc08ecS猫头猫    wrapper: {
2819dc08ecS猫头猫        width: '100%',
2919dc08ecS猫头猫        flex: 1,
3019dc08ecS猫头猫        justifyContent: 'center',
3119dc08ecS猫头猫        alignItems: 'center',
3219dc08ecS猫头猫    },
3319dc08ecS猫头猫    text: {
3419dc08ecS猫头猫        marginTop: rpx(48),
3519dc08ecS猫头猫    },
3619dc08ecS猫头猫});
37