Chore: Migrate E2EEnterYourPasswordView to Typescript (#3490)
Co-authored-by: AlexAlexandre <alexalexandrejr@gmail.com> Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
a22e9593b2
commit
c93e4420dc
|
@ -5,6 +5,7 @@ import scrollPersistTaps from '../utils/scrollPersistTaps';
|
||||||
|
|
||||||
interface IKeyboardViewProps extends KeyboardAwareScrollViewProps {
|
interface IKeyboardViewProps extends KeyboardAwareScrollViewProps {
|
||||||
keyboardVerticalOffset: number;
|
keyboardVerticalOffset: number;
|
||||||
|
scrollEnabled?: boolean;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { ScrollView, StyleSheet, Text } from 'react-native';
|
import { ScrollView, StyleSheet, Text } from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import { Dispatch } from 'redux';
|
||||||
|
import { StackNavigationOptions, StackNavigationProp } from '@react-navigation/stack';
|
||||||
|
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
import { withTheme } from '../theme';
|
import { withTheme } from '../theme';
|
||||||
|
@ -27,18 +28,26 @@ const styles = StyleSheet.create({
|
||||||
...sharedStyles.textRegular
|
...sharedStyles.textRegular
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
class E2EEnterYourPasswordView extends React.Component {
|
|
||||||
static navigationOptions = ({ navigation }) => ({
|
interface IE2EEnterYourPasswordViewState {
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IE2EEnterYourPasswordViewProps {
|
||||||
|
encryptionDecodeKey: (password: string) => void;
|
||||||
|
theme: string;
|
||||||
|
navigation: StackNavigationProp<any, 'E2EEnterYourPasswordView'>;
|
||||||
|
}
|
||||||
|
|
||||||
|
class E2EEnterYourPasswordView extends React.Component<IE2EEnterYourPasswordViewProps, IE2EEnterYourPasswordViewState> {
|
||||||
|
private passwordInput?: TextInput;
|
||||||
|
|
||||||
|
static navigationOptions = ({ navigation }: Pick<IE2EEnterYourPasswordViewProps, 'navigation'>): StackNavigationOptions => ({
|
||||||
headerLeft: () => <HeaderButton.CloseModal navigation={navigation} testID='e2e-enter-your-password-view-close' />,
|
headerLeft: () => <HeaderButton.CloseModal navigation={navigation} testID='e2e-enter-your-password-view-close' />,
|
||||||
title: I18n.t('Enter_Your_E2E_Password')
|
title: I18n.t('Enter_Your_E2E_Password')
|
||||||
});
|
});
|
||||||
|
|
||||||
static propTypes = {
|
constructor(props: IE2EEnterYourPasswordViewProps) {
|
||||||
encryptionDecodeKey: PropTypes.func,
|
|
||||||
theme: PropTypes.string
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
password: ''
|
password: ''
|
||||||
|
@ -65,12 +74,12 @@ class E2EEnterYourPasswordView extends React.Component {
|
||||||
<ScrollView
|
<ScrollView
|
||||||
{...scrollPersistTaps}
|
{...scrollPersistTaps}
|
||||||
style={sharedStyles.container}
|
style={sharedStyles.container}
|
||||||
contentContainerStyle={[sharedStyles.containerScrollView, styles.scrollView]}>
|
contentContainerStyle={sharedStyles.containerScrollView}>
|
||||||
<SafeAreaView
|
<SafeAreaView
|
||||||
style={[styles.container, { backgroundColor: themes[theme].backgroundColor }]}
|
style={[styles.container, { backgroundColor: themes[theme].backgroundColor }]}
|
||||||
testID='e2e-enter-your-password-view'>
|
testID='e2e-enter-your-password-view'>
|
||||||
<TextInput
|
<TextInput
|
||||||
inputRef={e => {
|
inputRef={(e: TextInput) => {
|
||||||
this.passwordInput = e;
|
this.passwordInput = e;
|
||||||
}}
|
}}
|
||||||
placeholder={I18n.t('Password')}
|
placeholder={I18n.t('Password')}
|
||||||
|
@ -99,7 +108,7 @@ class E2EEnterYourPasswordView extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = (dispatch: Dispatch) => ({
|
||||||
encryptionDecodeKey: password => dispatch(encryptionDecodeKeyAction(password))
|
encryptionDecodeKey: (password: string) => dispatch(encryptionDecodeKeyAction(password))
|
||||||
});
|
});
|
||||||
export default connect(null, mapDispatchToProps)(withTheme(E2EEnterYourPasswordView));
|
export default connect(null, mapDispatchToProps)(withTheme(E2EEnterYourPasswordView));
|
Loading…
Reference in New Issue