diff --git a/app/views/NewServerView/ServerInput/index.tsx b/app/views/NewServerView/ServerInput/index.tsx index c3399b730..1da151367 100644 --- a/app/views/NewServerView/ServerInput/index.tsx +++ b/app/views/NewServerView/ServerInput/index.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { FlatList, StyleSheet, View } from 'react-native'; +import { FlatList, StyleSheet, TextInputProps, View } from 'react-native'; import TextInput from '../../../containers/TextInput'; import * as List from '../../../containers/List'; @@ -28,11 +28,10 @@ const styles = StyleSheet.create({ } }); -interface IServerInput { +interface IServerInput extends TextInputProps { text: string; theme: string; serversHistory: any[]; - onChangeText(text: string): void; onSubmit(): void; onDelete(item: IServer): void; onPressServerHistory(serverHistory: IServer): void; diff --git a/app/views/NewServerView/index.tsx b/app/views/NewServerView/index.tsx index 815ec1347..f1458c93a 100644 --- a/app/views/NewServerView/index.tsx +++ b/app/views/NewServerView/index.tsx @@ -71,6 +71,7 @@ export interface IServer extends Model { url: string; username: string; } + interface INewServerView { navigation: StackNavigationProp; theme: string; @@ -91,6 +92,11 @@ interface IState { serversHistory: IServer[]; } +interface ISubmitParams { + fromServerHistory?: boolean; + username?: string; +} + class NewServerView extends React.Component { constructor(props: INewServerView) { super(props); @@ -184,10 +190,10 @@ class NewServerView extends React.Component { }; onPressServerHistory = (serverHistory: IServer) => { - this.setState({ text: serverHistory.url }, () => this.submit(true, serverHistory?.username)); + this.setState({ text: serverHistory.url }, () => this.submit({ fromServerHistory: true, username: serverHistory?.username })); }; - submit = async (fromServerHistory?: boolean, username?: string) => { + submit = async ({ fromServerHistory = false, username }: ISubmitParams = {}) => { logEvent(events.NS_CONNECT_TO_WORKSPACE); const { text, certificate } = this.state; const { connectServer } = this.props;