AuthLoadingView

This commit is contained in:
Diego Mello 2020-05-26 17:11:21 -03:00
parent 99e4dfcce0
commit c60bdfb208
1 changed files with 24 additions and 14 deletions

View File

@ -2,6 +2,8 @@ import React from 'react';
import { import {
View, Text, StyleSheet, ActivityIndicator View, Text, StyleSheet, ActivityIndicator
} from 'react-native'; } from 'react-native';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import I18n from '../i18n'; import I18n from '../i18n';
import StatusBar from '../containers/StatusBar'; import StatusBar from '../containers/StatusBar';
@ -24,17 +26,25 @@ const styles = StyleSheet.create({
} }
}); });
export default React.memo(withTheme(({ theme, route }) => { const AuthLoadingView = React.memo(({ theme, text }) => (
const text = route.params?.text; <View style={[styles.container, { backgroundColor: themes[theme].backgroundColor }]}>
return ( <StatusBar theme={theme} />
<View style={[styles.container, { backgroundColor: themes[theme].backgroundColor }]}> {text && (
<StatusBar theme={theme} /> <>
{text && ( <ActivityIndicator color={themes[theme].auxiliaryText} size='large' />
<> <Text style={[styles.text, { color: themes[theme].bodyText }]}>{`${ text }\n${ I18n.t('Please_wait') }`}</Text>
<ActivityIndicator color={themes[theme].auxiliaryText} size='large' /> </>
<Text style={[styles.text, { color: themes[theme].bodyText }]}>{`${ text }\n${ I18n.t('Please_wait') }`}</Text> )}
</> </View>
)} ));
</View>
); const mapStateToProps = state => ({
})); text: state.app.text
});
AuthLoadingView.propTypes = {
theme: PropTypes.string,
text: PropTypes.string
};
export default connect(mapStateToProps)(withTheme(AuthLoadingView));