[IMPROVE] migrate BackgroundContainer component
This commit is contained in:
parent
a18b13c06b
commit
b0ddb87c88
|
@ -24,7 +24,7 @@ stories.add('long text', () => (
|
||||||
<BackgroundContainer text={longText} />
|
<BackgroundContainer text={longText} />
|
||||||
));
|
));
|
||||||
|
|
||||||
const ThemeStory = ({ theme, ...props }) => (
|
const ThemeStory = ({ theme, ...props }: any) => (
|
||||||
<ThemeContext.Provider
|
<ThemeContext.Provider
|
||||||
value={{ theme }}
|
value={{ theme }}
|
||||||
>
|
>
|
|
@ -1,13 +1,16 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {
|
import { ImageBackground, StyleSheet, Text, View, ActivityIndicator } from 'react-native';
|
||||||
ImageBackground, StyleSheet, Text, View, ActivityIndicator
|
|
||||||
} from 'react-native';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
import { withTheme } from '../../theme';
|
import { withTheme } from '../../theme';
|
||||||
import sharedStyles from '../../views/Styles';
|
import sharedStyles from '../../views/Styles';
|
||||||
import { themes } from '../../constants/colors';
|
import { themes } from '../../constants/colors';
|
||||||
|
|
||||||
|
interface IBackgroundContainer {
|
||||||
|
text: string;
|
||||||
|
theme: string;
|
||||||
|
loading: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1
|
flex: 1
|
||||||
|
@ -29,17 +32,14 @@ const styles = StyleSheet.create({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const BackgroundContainer = ({ theme, text, loading }) => (
|
const BackgroundContainer = ({ theme, text, loading }: IBackgroundContainer) => (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<ImageBackground source={{ uri: `message_empty_${ theme }` }} style={styles.image} />
|
<ImageBackground source={{ uri: `message_empty_${ theme }` }} style={styles.image} />
|
||||||
{text ? <Text style={[styles.text, { color: themes[theme].auxiliaryTintColor }]}>{text}</Text> : null}
|
{text ? <Text style={[styles.text, { color: themes[theme].auxiliaryTintColor }]}>{text}</Text> : null}
|
||||||
{loading ? <ActivityIndicator style={[styles.text, { color: themes[theme].auxiliaryTintColor }]} /> : null}
|
{/*{loading ? <ActivityIndicator style={[styles.text, { color: themes[theme].auxiliaryTintColor }]} /> : null}*/}
|
||||||
|
{loading ? <ActivityIndicator color={themes[theme].auxiliaryTintColor} style={styles.text} /> : null}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
||||||
BackgroundContainer.propTypes = {
|
|
||||||
text: PropTypes.string,
|
|
||||||
theme: PropTypes.string,
|
|
||||||
loading: PropTypes.bool
|
|
||||||
};
|
|
||||||
export default withTheme(BackgroundContainer);
|
export default withTheme(BackgroundContainer);
|
Loading…
Reference in New Issue