chore: evaluate `NewServerView` (#4101)

This commit is contained in:
Gerzon Z 2022-05-03 11:48:02 -04:00 committed by GitHub
parent 5dea514751
commit 99409d1af4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -14,7 +14,7 @@ import Button from '../../containers/Button';
import FormContainer, { FormContainerInner } from '../../containers/FormContainer';
import * as HeaderButton from '../../containers/HeaderButton';
import OrSeparator from '../../containers/OrSeparator';
import { IBaseScreen, TServerHistoryModel } from '../../definitions';
import { IApplicationState, IBaseScreen, TServerHistoryModel } from '../../definitions';
import { withDimensions } from '../../dimensions';
import I18n from '../../i18n';
import database from '../../lib/database';
@ -67,7 +67,7 @@ const styles = StyleSheet.create({
interface INewServerViewProps extends IBaseScreen<OutsideParamList, 'NewServerView'> {
connecting: boolean;
previousServer: string;
previousServer: string | null;
width: number;
height: number;
}
@ -75,7 +75,7 @@ interface INewServerViewProps extends IBaseScreen<OutsideParamList, 'NewServerVi
interface INewServerViewState {
text: string;
connectingOpen: boolean;
certificate: any;
certificate: string | null;
serversHistory: TServerHistoryModel[];
}
@ -162,7 +162,9 @@ class NewServerView extends React.Component<INewServerViewProps, INewServerViewS
close = () => {
const { dispatch, previousServer } = this.props;
dispatch(inviteLinksClear());
dispatch(selectServerRequest(previousServer));
if (previousServer) {
dispatch(selectServerRequest(previousServer));
}
};
handleNewServerEvent = (event: { server: string }) => {
@ -265,8 +267,7 @@ class NewServerView extends React.Component<INewServerViewProps, INewServerViewS
showConfirmationAlert({
message: I18n.t('You_will_unset_a_certificate_for_this_server'),
confirmationText: I18n.t('Remove'),
// @ts-ignore
onPress: this.setState({ certificate: null }) // We not need delete file from DocumentPicker because it is a temp file
onPress: () => this.setState({ certificate: null }) // We not need delete file from DocumentPicker because it is a temp file
});
};
@ -405,7 +406,7 @@ class NewServerView extends React.Component<INewServerViewProps, INewServerViewS
}
}
const mapStateToProps = (state: any) => ({
const mapStateToProps = (state: IApplicationState) => ({
connecting: state.server.connecting,
previousServer: state.server.previousServer
});