Chore: Migrate AuthLoadingView to Typescript (#3424)

* chore: Migrate AuthLoadingView from js to tsx

* minor tweak
This commit is contained in:
Reinaldo Neto 2021-10-05 10:54:08 -03:00 committed by GitHub
parent d19f1245e6
commit 62562ebba9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 10 deletions

View File

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