diff --git a/app/AppContainer.tsx b/app/AppContainer.tsx index f7f08bb27..00d851010 100644 --- a/app/AppContainer.tsx +++ b/app/AppContainer.tsx @@ -5,7 +5,7 @@ import { connect } from 'react-redux'; import Navigation from './lib/Navigation'; import { defaultHeader, getActiveRouteName, navigationTheme } from './utils/navigation'; -import { ROOT_INSIDE, ROOT_LOADING, ROOT_OUTSIDE, ROOT_SET_USERNAME } from './actions/app'; +import { ROOT_INSIDE, ROOT_LOADING, ROOT_NEW_SERVER, ROOT_OUTSIDE, ROOT_SET_USERNAME } from './actions/app'; // Stacks import AuthLoadingView from './views/AuthLoadingView'; // SetUsername Stack @@ -56,7 +56,9 @@ const App = React.memo(({ root, isMasterDetail }: { root: string; isMasterDetail <> {root === ROOT_LOADING ? : null} - {root === ROOT_OUTSIDE ? : null} + {root === ROOT_OUTSIDE || root === ROOT_NEW_SERVER ? ( + + ) : null} {root === ROOT_INSIDE && isMasterDetail ? ( ) : null} diff --git a/app/actions/app.js b/app/actions/app.js index fe6981d67..8ae77a6af 100644 --- a/app/actions/app.js +++ b/app/actions/app.js @@ -1,6 +1,7 @@ import { APP } from './actionsTypes'; export const ROOT_OUTSIDE = 'outside'; +export const ROOT_NEW_SERVER = 'newServer'; export const ROOT_INSIDE = 'inside'; export const ROOT_LOADING = 'loading'; export const ROOT_SET_USERNAME = 'setUsername'; diff --git a/app/views/NewServerView/index.js b/app/views/NewServerView/index.js index bd1730a8d..487aa7d11 100644 --- a/app/views/NewServerView/index.js +++ b/app/views/NewServerView/index.js @@ -9,6 +9,7 @@ import { TouchableOpacity } from 'react-native-gesture-handler'; import UserPreferences from '../../lib/userPreferences'; import EventEmitter from '../../utils/events'; +import { ROOT_NEW_SERVER } from '../../actions/app'; import { selectServerRequest, serverRequest } from '../../actions/server'; import { inviteLinksClear as inviteLinksClearAction } from '../../actions/inviteLinks'; import sharedStyles from '../Styles'; @@ -77,10 +78,6 @@ const styles = StyleSheet.create({ }); class NewServerView extends React.Component { - static navigationOptions = { - headerShown: false - }; - static propTypes = { navigation: PropTypes.object, theme: PropTypes.string, @@ -89,7 +86,8 @@ class NewServerView extends React.Component { selectServer: PropTypes.func.isRequired, adding: PropTypes.bool, previousServer: PropTypes.string, - inviteLinksClear: PropTypes.func + inviteLinksClear: PropTypes.func, + root: PropTypes.string }; constructor(props) { @@ -123,11 +121,16 @@ class NewServerView extends React.Component { } setHeader = () => { - const { adding, navigation } = this.props; - if (adding) { + const { adding, navigation, root } = this.props; + if (adding && root === ROOT_NEW_SERVER) { navigation.setOptions({ + headerTitle: I18n.t('Workspaces'), headerLeft: () => }); + } else { + navigation.setOptions({ + headerShown: false + }); } }; @@ -365,7 +368,8 @@ class NewServerView extends React.Component { const mapStateToProps = state => ({ connecting: state.server.connecting, adding: state.server.adding, - previousServer: state.server.previousServer + previousServer: state.server.previousServer, + root: state.app.root }); const mapDispatchToProps = dispatch => ({ diff --git a/app/views/RoomsListView/ServerDropdown.js b/app/views/RoomsListView/ServerDropdown.js index 030197669..5925cb1c7 100644 --- a/app/views/RoomsListView/ServerDropdown.js +++ b/app/views/RoomsListView/ServerDropdown.js @@ -8,7 +8,7 @@ import * as List from '../../containers/List'; import Button from '../../containers/Button'; import { toggleServerDropdown as toggleServerDropdownAction } from '../../actions/rooms'; import { selectServerRequest as selectServerRequestAction, serverInitAdd as serverInitAddAction } from '../../actions/server'; -import { ROOT_OUTSIDE, appStart as appStartAction } from '../../actions/app'; +import { appStart as appStartAction, ROOT_NEW_SERVER } from '../../actions/app'; import RocketChat from '../../lib/rocketchat'; import I18n from '../../i18n'; import EventEmitter from '../../utils/events'; @@ -111,7 +111,7 @@ class ServerDropdown extends Component { navToNewServer = previousServer => { const { appStart, initAdd } = this.props; batch(() => { - appStart({ root: ROOT_OUTSIDE }); + appStart({ root: ROOT_NEW_SERVER }); initAdd(previousServer); }); };