2020-10-30 17:35:07 +00:00
|
|
|
import React from 'react';
|
|
|
|
import {
|
2021-04-07 18:31:25 +00:00
|
|
|
ImageBackground, StyleSheet, Text, View, ActivityIndicator
|
2020-10-30 17:35:07 +00:00
|
|
|
} from 'react-native';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import { withTheme } from '../../theme';
|
2021-04-07 18:31:25 +00:00
|
|
|
import sharedStyles from '../../views/Styles';
|
2020-10-30 17:35:07 +00:00
|
|
|
import { themes } from '../../constants/colors';
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
|
|
|
flex: 1
|
|
|
|
},
|
|
|
|
image: {
|
|
|
|
width: '100%',
|
|
|
|
height: '100%',
|
|
|
|
position: 'absolute'
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
position: 'absolute',
|
|
|
|
top: 60,
|
|
|
|
left: 0,
|
|
|
|
right: 0,
|
|
|
|
fontSize: 16,
|
|
|
|
paddingHorizontal: 24,
|
2020-11-30 21:47:05 +00:00
|
|
|
...sharedStyles.textRegular,
|
|
|
|
...sharedStyles.textAlignCenter
|
2020-10-30 17:35:07 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-04-07 18:31:25 +00:00
|
|
|
const BackgroundContainer = ({ theme, text, loading }) => (
|
2020-10-30 17:35:07 +00:00
|
|
|
<View style={styles.container}>
|
|
|
|
<ImageBackground source={{ uri: `message_empty_${ theme }` }} style={styles.image} />
|
2021-04-07 18:31:25 +00:00
|
|
|
{text ? <Text style={[styles.text, { color: themes[theme].auxiliaryTintColor }]}>{text}</Text> : null}
|
|
|
|
{loading ? <ActivityIndicator style={[styles.text, { color: themes[theme].auxiliaryTintColor }]} /> : null}
|
2020-10-30 17:35:07 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
|
2021-04-07 18:31:25 +00:00
|
|
|
BackgroundContainer.propTypes = {
|
2020-10-30 17:35:07 +00:00
|
|
|
text: PropTypes.string,
|
2021-04-07 18:31:25 +00:00
|
|
|
theme: PropTypes.string,
|
|
|
|
loading: PropTypes.bool
|
2020-10-30 17:35:07 +00:00
|
|
|
};
|
2021-04-07 18:31:25 +00:00
|
|
|
export default withTheme(BackgroundContainer);
|