diff --git a/app/views/RegisterView.tsx b/app/views/RegisterView.tsx index e82f0efc4..bd3d78d30 100644 --- a/app/views/RegisterView.tsx +++ b/app/views/RegisterView.tsx @@ -1,5 +1,5 @@ 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 { connect } from 'react-redux'; @@ -64,12 +64,12 @@ interface IProps extends IBaseScreen { class RegisterView extends React.Component { private parsedCustomFields: any; - private usernameInput: any; - private passwordInput: any; - private emailInput: any; - private avatarUrl: any; + private usernameInput?: RNTextInput | null; + private passwordInput?: RNTextInput | null; + private emailInput?: RNTextInput | null; + private avatarUrl?: RNTextInput | null; - static navigationOptions = ({ route, navigation }: Partial) => ({ + static navigationOptions = ({ route, navigation }: IProps) => ({ title: route?.params?.title ?? 'Rocket.Chat', headerRight: () => }); @@ -188,7 +188,7 @@ class RegisterView extends React.Component { }} value={customFields[key]}> { + inputRef={e => { // @ts-ignore this[key] = e; }} @@ -221,7 +221,7 @@ class RegisterView extends React.Component { // @ts-ignore return this[array[index + 1]].focus(); } - this.avatarUrl.focus(); + this.avatarUrl?.focus(); }} containerStyle={styles.inputContainer} theme={theme} @@ -250,7 +250,7 @@ class RegisterView extends React.Component { returnKeyType='next' onChangeText={(name: string) => this.setState({ name })} onSubmitEditing={() => { - this.usernameInput.focus(); + this.usernameInput?.focus(); }} testID='register-view-name' theme={theme} @@ -265,7 +265,7 @@ class RegisterView extends React.Component { returnKeyType='next' onChangeText={(username: string) => this.setState({ username })} onSubmitEditing={() => { - this.emailInput.focus(); + this.emailInput?.focus(); }} testID='register-view-username' theme={theme} @@ -281,7 +281,7 @@ class RegisterView extends React.Component { keyboardType='email-address' onChangeText={(email: string) => this.setState({ email })} onSubmitEditing={() => { - this.passwordInput.focus(); + this.passwordInput?.focus(); }} testID='register-view-email' theme={theme}