[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 Diego Mello
parent 76c4ce74cd
commit 522c9da4d4
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));