[FIX] Cancelling when adding a server (#4565)

* TC-110 [FIX] Cancelling when adding a server

* Removing the close button when connecting to a server
This commit is contained in:
Reinaldo Neto 2022-11-01 14:09:00 -03:00 committed by GitHub
parent 816f43b828
commit 711cac5876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 2 deletions

View File

@ -116,12 +116,21 @@ class NewServerView extends React.Component<INewServerViewProps, INewServerViewS
}
}
componentDidUpdate(prevProps: Readonly<INewServerViewProps>) {
if (prevProps.connecting !== this.props.connecting) {
this.setHeader();
}
}
setHeader = () => {
const { previousServer, navigation } = this.props;
const { previousServer, navigation, connecting } = this.props;
if (previousServer) {
return navigation.setOptions({
headerTitle: I18n.t('Workspaces'),
headerLeft: () => <HeaderButton.CloseModal navigation={navigation} onPress={this.close} testID='new-server-view-close' />
headerLeft: () =>
!connecting ? (
<HeaderButton.CloseModal navigation={navigation} onPress={this.close} testID='new-server-view-close' />
) : null
});
}
@ -162,6 +171,7 @@ class NewServerView extends React.Component<INewServerViewProps, INewServerViewS
close = () => {
const { dispatch, previousServer } = this.props;
dispatch(inviteLinksClear());
if (previousServer) {
dispatch(selectServerRequest(previousServer));