From c60bdfb208d8451d6c177c0fe5c5aac317bd1192 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Tue, 26 May 2020 17:11:21 -0300 Subject: [PATCH] AuthLoadingView --- app/views/AuthLoadingView.js | 38 +++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/app/views/AuthLoadingView.js b/app/views/AuthLoadingView.js index dc8495558..6769af899 100644 --- a/app/views/AuthLoadingView.js +++ b/app/views/AuthLoadingView.js @@ -2,6 +2,8 @@ import React from 'react'; import { View, Text, StyleSheet, ActivityIndicator } from 'react-native'; +import PropTypes from 'prop-types'; +import { connect } from 'react-redux'; import I18n from '../i18n'; import StatusBar from '../containers/StatusBar'; @@ -24,17 +26,25 @@ const styles = StyleSheet.create({ } }); -export default React.memo(withTheme(({ theme, route }) => { - const text = route.params?.text; - return ( - - - {text && ( - <> - - {`${ text }\n${ I18n.t('Please_wait') }`} - - )} - - ); -})); +const AuthLoadingView = React.memo(({ theme, text }) => ( + + + {text && ( + <> + + {`${ text }\n${ I18n.t('Please_wait') }`} + + )} + +)); + +const mapStateToProps = state => ({ + text: state.app.text +}); + +AuthLoadingView.propTypes = { + theme: PropTypes.string, + text: PropTypes.string +}; + +export default connect(mapStateToProps)(withTheme(AuthLoadingView));