Chore: Evaluate RegisterView - TypeScript (#4114)

This commit is contained in:
Reinaldo Neto 2022-05-02 23:21:43 -03:00 committed by GitHub
parent d24e59669a
commit 5d29fcad53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 11 deletions

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Keyboard, StyleSheet, Text, View } from 'react-native'; import { Keyboard, StyleSheet, Text, View, TextInput as RNTextInput } from 'react-native';
import RNPickerSelect from 'react-native-picker-select'; import RNPickerSelect from 'react-native-picker-select';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
@ -64,12 +64,12 @@ interface IProps extends IBaseScreen<OutsideParamList, 'RegisterView'> {
class RegisterView extends React.Component<IProps, any> { class RegisterView extends React.Component<IProps, any> {
private parsedCustomFields: any; private parsedCustomFields: any;
private usernameInput: any; private usernameInput?: RNTextInput | null;
private passwordInput: any; private passwordInput?: RNTextInput | null;
private emailInput: any; private emailInput?: RNTextInput | null;
private avatarUrl: any; private avatarUrl?: RNTextInput | null;
static navigationOptions = ({ route, navigation }: Partial<IProps>) => ({ static navigationOptions = ({ route, navigation }: IProps) => ({
title: route?.params?.title ?? 'Rocket.Chat', title: route?.params?.title ?? 'Rocket.Chat',
headerRight: () => <HeaderButton.Legal testID='register-view-more' navigation={navigation} /> headerRight: () => <HeaderButton.Legal testID='register-view-more' navigation={navigation} />
}); });
@ -188,7 +188,7 @@ class RegisterView extends React.Component<IProps, any> {
}} }}
value={customFields[key]}> value={customFields[key]}>
<TextInput <TextInput
inputRef={(e: any) => { inputRef={e => {
// @ts-ignore // @ts-ignore
this[key] = e; this[key] = e;
}} }}
@ -221,7 +221,7 @@ class RegisterView extends React.Component<IProps, any> {
// @ts-ignore // @ts-ignore
return this[array[index + 1]].focus(); return this[array[index + 1]].focus();
} }
this.avatarUrl.focus(); this.avatarUrl?.focus();
}} }}
containerStyle={styles.inputContainer} containerStyle={styles.inputContainer}
theme={theme} theme={theme}
@ -250,7 +250,7 @@ class RegisterView extends React.Component<IProps, any> {
returnKeyType='next' returnKeyType='next'
onChangeText={(name: string) => this.setState({ name })} onChangeText={(name: string) => this.setState({ name })}
onSubmitEditing={() => { onSubmitEditing={() => {
this.usernameInput.focus(); this.usernameInput?.focus();
}} }}
testID='register-view-name' testID='register-view-name'
theme={theme} theme={theme}
@ -265,7 +265,7 @@ class RegisterView extends React.Component<IProps, any> {
returnKeyType='next' returnKeyType='next'
onChangeText={(username: string) => this.setState({ username })} onChangeText={(username: string) => this.setState({ username })}
onSubmitEditing={() => { onSubmitEditing={() => {
this.emailInput.focus(); this.emailInput?.focus();
}} }}
testID='register-view-username' testID='register-view-username'
theme={theme} theme={theme}
@ -281,7 +281,7 @@ class RegisterView extends React.Component<IProps, any> {
keyboardType='email-address' keyboardType='email-address'
onChangeText={(email: string) => this.setState({ email })} onChangeText={(email: string) => this.setState({ email })}
onSubmitEditing={() => { onSubmitEditing={() => {
this.passwordInput.focus(); this.passwordInput?.focus();
}} }}
testID='register-view-email' testID='register-view-email'
theme={theme} theme={theme}