2020-03-07 11:49:32 +01:00
|
|
|
import * as React from 'react';
|
|
|
|
import {ActivityIndicator, Subheading, withTheme} from 'react-native-paper';
|
2020-03-29 14:46:44 +02:00
|
|
|
import {StyleSheet, View} from "react-native";
|
2020-03-07 11:49:32 +01:00
|
|
|
import {MaterialCommunityIcons} from "@expo/vector-icons";
|
|
|
|
|
2020-03-29 14:46:44 +02:00
|
|
|
/**
|
|
|
|
* Component used to display a message when a list is empty
|
|
|
|
*
|
|
|
|
* @param props Props to pass to the component
|
|
|
|
* @return {*}
|
|
|
|
*/
|
|
|
|
function EmptyWebSectionListItem(props: { text: string, icon: string, refreshing: boolean, theme: {} }) {
|
|
|
|
const {colors} = props.theme;
|
2020-03-07 11:49:32 +01:00
|
|
|
return (
|
|
|
|
<View>
|
2020-03-29 14:46:44 +02:00
|
|
|
<View style={styles.iconContainer}>
|
2020-03-07 11:49:32 +01:00
|
|
|
{props.refreshing ?
|
|
|
|
<ActivityIndicator
|
|
|
|
animating={true}
|
|
|
|
size={'large'}
|
|
|
|
color={colors.primary}/>
|
|
|
|
:
|
|
|
|
<MaterialCommunityIcons
|
|
|
|
name={props.icon}
|
|
|
|
size={100}
|
|
|
|
color={colors.textDisabled}/>}
|
|
|
|
</View>
|
|
|
|
|
|
|
|
<Subheading style={{
|
2020-03-29 14:46:44 +02:00
|
|
|
...styles.subheading,
|
2020-03-07 11:49:32 +01:00
|
|
|
color: colors.textDisabled
|
|
|
|
}}>
|
|
|
|
{props.text}
|
|
|
|
</Subheading>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-03-29 14:46:44 +02:00
|
|
|
const styles = StyleSheet.create({
|
|
|
|
iconContainer: {
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center',
|
|
|
|
width: '100%',
|
|
|
|
height: 100,
|
|
|
|
marginBottom: 20
|
|
|
|
},
|
|
|
|
subheading: {
|
|
|
|
textAlign: 'center',
|
|
|
|
marginRight: 20,
|
|
|
|
marginLeft: 20,
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-07 11:49:32 +01:00
|
|
|
export default withTheme(EmptyWebSectionListItem);
|