[FIX] NewServerView skipping WorkspaceView (#3455)
* Initial commit * Fix interface * Unrequired change on onPress/onSubmit
This commit is contained in:
parent
0a44731229
commit
87a99089ce
|
@ -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;
|
||||
|
|
|
@ -71,6 +71,7 @@ export interface IServer extends Model {
|
|||
url: string;
|
||||
username: string;
|
||||
}
|
||||
|
||||
interface INewServerView {
|
||||
navigation: StackNavigationProp<any, 'NewServerView'>;
|
||||
theme: string;
|
||||
|
@ -91,6 +92,11 @@ interface IState {
|
|||
serversHistory: IServer[];
|
||||
}
|
||||
|
||||
interface ISubmitParams {
|
||||
fromServerHistory?: boolean;
|
||||
username?: string;
|
||||
}
|
||||
|
||||
class NewServerView extends React.Component<INewServerView, IState> {
|
||||
constructor(props: INewServerView) {
|
||||
super(props);
|
||||
|
@ -184,10 +190,10 @@ class NewServerView extends React.Component<INewServerView, IState> {
|
|||
};
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue