xref: /MusicFree/src/components/base/loading.tsx (revision 2aa881935ca35b8fb1abc4206e0dc35149231456)
1import React from 'react';
2import {StyleSheet, View} from 'react-native';
3import rpx from '@/utils/rpx';
4import {ActivityIndicator, useTheme} from 'react-native-paper';
5import ThemeText from './themeText';
6
7interface ILoadingProps {
8    text?: string;
9}
10export default function Loading(props: ILoadingProps) {
11    const {colors} = useTheme();
12
13    return (
14        <View style={style.wrapper}>
15            <ActivityIndicator animating color={colors.text} />
16            <ThemeText
17                fontSize="title"
18                fontWeight="semibold"
19                style={style.text}>
20                {props?.text ?? '加载中...'}
21            </ThemeText>
22        </View>
23    );
24}
25
26const style = StyleSheet.create({
27    wrapper: {
28        width: '100%',
29        flex: 1,
30        justifyContent: 'center',
31        alignItems: 'center',
32    },
33    text: {
34        marginTop: rpx(48),
35    },
36});
37