2021-09-13 20:41:05 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { ActivityIndicator, ActivityIndicatorProps, StyleSheet } from 'react-native';
|
|
|
|
|
2022-03-18 02:37:10 +00:00
|
|
|
import { useTheme } from '../theme';
|
2022-04-07 14:10:03 +00:00
|
|
|
import { themes } from '../lib/constants';
|
2021-09-13 20:41:05 +00:00
|
|
|
|
|
|
|
interface IActivityIndicator extends ActivityIndicatorProps {
|
|
|
|
absolute?: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
indicator: {
|
|
|
|
padding: 16,
|
|
|
|
flex: 1
|
|
|
|
},
|
|
|
|
absolute: {
|
|
|
|
position: 'absolute',
|
|
|
|
left: 0,
|
|
|
|
right: 0,
|
|
|
|
top: 0,
|
|
|
|
bottom: 0,
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-03-18 02:37:10 +00:00
|
|
|
const RCActivityIndicator = ({ absolute, ...props }: IActivityIndicator): React.ReactElement => {
|
|
|
|
const { theme } = useTheme();
|
|
|
|
return (
|
|
|
|
<ActivityIndicator style={[styles.indicator, absolute && styles.absolute]} color={themes[theme].auxiliaryText} {...props} />
|
|
|
|
);
|
|
|
|
};
|
2021-09-13 20:41:05 +00:00
|
|
|
|
|
|
|
export default RCActivityIndicator;
|