OutsideStack.tsx 2.6 KB
Newer Older
1
import React from 'react';
2
import { createStackNavigator, StackNavigationOptions } from '@react-navigation/stack';
3
4
5
import { connect } from 'react-redux';

import { ThemeContext } from '../theme';
6
import { ModalAnimation, StackAnimation, defaultHeader, themedHeader } from '../utils/navigation';
7
8
9
10
11
// Outside Stack
import NewServerView from '../views/NewServerView';
import WorkspaceView from '../views/WorkspaceView';
import LoginView from '../views/LoginView';
import ForgotPasswordView from '../views/ForgotPasswordView';
12
import SendEmailConfirmationView from '../views/SendEmailConfirmationView';
13
14
15
import RegisterView from '../views/RegisterView';
import LegalView from '../views/LegalView';
import AuthenticationWebView from '../views/AuthenticationWebView';
16
import { OutsideModalParamList, OutsideParamList } from './types';
17
18

// Outside
19
const Outside = createStackNavigator<OutsideParamList>();
20
const _OutsideStack = () => {
21
22
23
	const { theme } = React.useContext(ThemeContext);

	return (
24
		<Outside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation } as StackNavigationOptions}>
25
26
27
28
			<Outside.Screen name='NewServerView' component={NewServerView} options={NewServerView.navigationOptions} />
			<Outside.Screen name='WorkspaceView' component={WorkspaceView} options={WorkspaceView.navigationOptions} />
			<Outside.Screen name='LoginView' component={LoginView} options={LoginView.navigationOptions} />
			<Outside.Screen name='ForgotPasswordView' component={ForgotPasswordView} options={ForgotPasswordView.navigationOptions} />
29
			<Outside.Screen name='SendEmailConfirmationView' component={SendEmailConfirmationView} />
30
31
			<Outside.Screen name='RegisterView' component={RegisterView} options={RegisterView.navigationOptions} />
			<Outside.Screen name='LegalView' component={LegalView} options={LegalView.navigationOptions} />
32
33
34
35
		</Outside.Navigator>
	);
};

36
const mapStateToProps = (state: any) => ({
37
38
39
40
41
42
	root: state.app.root
});

const OutsideStack = connect(mapStateToProps)(_OutsideStack);

// OutsideStackModal
43
const OutsideModal = createStackNavigator<OutsideModalParamList>();
44
45
46
47
48
const OutsideStackModal = () => {
	const { theme } = React.useContext(ThemeContext);

	return (
		<OutsideModal.Navigator mode='modal' screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...ModalAnimation }}>
49
			<OutsideModal.Screen name='OutsideStack' component={OutsideStack} options={{ headerShown: false }} />
50
51
52
53
54
55
56
57
58
59
			<OutsideModal.Screen
				name='AuthenticationWebView'
				component={AuthenticationWebView}
				options={AuthenticationWebView.navigationOptions}
			/>
		</OutsideModal.Navigator>
	);
};

export default OutsideStackModal;