[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:
parent
816f43b828
commit
711cac5876
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue