2020-02-03 12:17:59 +01:00
|
|
|
// @flow
|
|
|
|
|
2020-03-05 10:29:15 +01:00
|
|
|
import * as React from 'react';
|
|
|
|
import {createDrawerNavigator} from '@react-navigation/drawer';
|
|
|
|
import TabNavigator from './MainTabNavigator';
|
2020-02-03 12:17:59 +01:00
|
|
|
import SettingsScreen from '../screens/SettingsScreen';
|
|
|
|
import AboutScreen from '../screens/About/AboutScreen';
|
|
|
|
import AboutDependenciesScreen from '../screens/About/AboutDependenciesScreen';
|
|
|
|
import SelfMenuScreen from '../screens/SelfMenuScreen';
|
|
|
|
import AvailableRoomScreen from "../screens/Websites/AvailableRoomScreen";
|
2020-03-06 09:12:56 +01:00
|
|
|
import BibScreen from "../screens/Websites/BibScreen";
|
2020-03-08 14:22:03 +01:00
|
|
|
import DebugScreen from '../screens/About/DebugScreen';
|
2020-02-03 12:17:59 +01:00
|
|
|
import Sidebar from "../components/Sidebar";
|
2020-03-05 10:29:15 +01:00
|
|
|
import {createStackNavigator, TransitionPresets} from "@react-navigation/stack";
|
2020-03-07 11:49:32 +01:00
|
|
|
import HeaderButton from "../components/HeaderButton";
|
2020-03-08 12:17:04 +01:00
|
|
|
import i18n from "i18n-js";
|
2020-03-06 09:12:56 +01:00
|
|
|
|
|
|
|
const defaultScreenOptions = {
|
|
|
|
gestureEnabled: true,
|
|
|
|
cardOverlayEnabled: true,
|
|
|
|
...TransitionPresets.SlideFromRightIOS,
|
|
|
|
};
|
|
|
|
|
|
|
|
function getDrawerButton(navigation: Object) {
|
|
|
|
return (
|
2020-03-07 11:49:32 +01:00
|
|
|
<HeaderButton icon={'menu'} onPress={navigation.openDrawer}/>
|
2020-03-06 09:12:56 +01:00
|
|
|
);
|
|
|
|
}
|
2020-02-03 12:17:59 +01:00
|
|
|
|
2020-03-05 10:29:15 +01:00
|
|
|
const AboutStack = createStackNavigator();
|
2020-02-03 12:17:59 +01:00
|
|
|
|
2020-03-05 10:29:15 +01:00
|
|
|
function AboutStackComponent() {
|
|
|
|
return (
|
|
|
|
<AboutStack.Navigator
|
|
|
|
initialRouteName="AboutScreen"
|
2020-03-06 09:12:56 +01:00
|
|
|
headerMode="float"
|
|
|
|
screenOptions={defaultScreenOptions}
|
2020-03-05 10:29:15 +01:00
|
|
|
>
|
|
|
|
<AboutStack.Screen
|
|
|
|
name="AboutScreen"
|
|
|
|
component={AboutScreen}
|
2020-03-06 09:12:56 +01:00
|
|
|
options={({navigation}) => {
|
|
|
|
const openDrawer = getDrawerButton.bind(this, navigation);
|
|
|
|
return {
|
2020-03-08 12:17:04 +01:00
|
|
|
title: i18n.t('screens.about'),
|
2020-03-06 09:12:56 +01:00
|
|
|
headerLeft: openDrawer
|
|
|
|
};
|
|
|
|
}}
|
2020-03-05 10:29:15 +01:00
|
|
|
/>
|
|
|
|
<AboutStack.Screen
|
|
|
|
name="AboutDependenciesScreen"
|
|
|
|
component={AboutDependenciesScreen}
|
2020-03-06 09:12:56 +01:00
|
|
|
options={{
|
2020-03-08 12:17:04 +01:00
|
|
|
title: i18n.t('aboutScreen.libs')
|
2020-03-06 09:12:56 +01:00
|
|
|
}}
|
2020-03-05 10:29:15 +01:00
|
|
|
/>
|
|
|
|
<AboutStack.Screen
|
|
|
|
name="DebugScreen"
|
|
|
|
component={DebugScreen}
|
2020-03-06 09:12:56 +01:00
|
|
|
options={{
|
2020-03-08 12:17:04 +01:00
|
|
|
title: i18n.t('aboutScreen.debug')
|
2020-03-06 09:12:56 +01:00
|
|
|
}}
|
2020-03-05 10:29:15 +01:00
|
|
|
/>
|
|
|
|
</AboutStack.Navigator>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-03-06 09:12:56 +01:00
|
|
|
const SettingsStack = createStackNavigator();
|
|
|
|
|
|
|
|
function SettingsStackComponent() {
|
|
|
|
return (
|
|
|
|
<SettingsStack.Navigator
|
|
|
|
initialRouteName="SettingsScreen"
|
|
|
|
headerMode="float"
|
|
|
|
screenOptions={defaultScreenOptions}
|
|
|
|
>
|
|
|
|
<SettingsStack.Screen
|
|
|
|
name="SettingsScreen"
|
|
|
|
component={SettingsScreen}
|
|
|
|
options={({navigation}) => {
|
|
|
|
const openDrawer = getDrawerButton.bind(this, navigation);
|
|
|
|
return {
|
2020-03-08 12:17:04 +01:00
|
|
|
title: i18n.t('screens.settings'),
|
2020-03-06 09:12:56 +01:00
|
|
|
headerLeft: openDrawer
|
|
|
|
};
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</SettingsStack.Navigator>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const SelfMenuStack = createStackNavigator();
|
|
|
|
|
|
|
|
function SelfMenuStackComponent() {
|
|
|
|
return (
|
|
|
|
<SelfMenuStack.Navigator
|
|
|
|
initialRouteName="SelfMenuScreen"
|
|
|
|
headerMode="float"
|
|
|
|
screenOptions={defaultScreenOptions}
|
|
|
|
>
|
|
|
|
<SelfMenuStack.Screen
|
|
|
|
name="SelfMenuScreen"
|
|
|
|
component={SelfMenuScreen}
|
|
|
|
options={({navigation}) => {
|
|
|
|
const openDrawer = getDrawerButton.bind(this, navigation);
|
|
|
|
return {
|
2020-03-08 12:17:04 +01:00
|
|
|
title: i18n.t('screens.menuSelf'),
|
2020-03-06 09:12:56 +01:00
|
|
|
headerLeft: openDrawer
|
|
|
|
};
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</SelfMenuStack.Navigator>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const AvailableRoomStack = createStackNavigator();
|
|
|
|
|
|
|
|
function AvailableRoomStackComponent() {
|
|
|
|
return (
|
|
|
|
<AvailableRoomStack.Navigator
|
|
|
|
initialRouteName="AvailableRoomScreen"
|
|
|
|
headerMode="float"
|
|
|
|
screenOptions={defaultScreenOptions}
|
|
|
|
>
|
|
|
|
<AvailableRoomStack.Screen
|
|
|
|
name="AvailableRoomScreen"
|
|
|
|
component={AvailableRoomScreen}
|
|
|
|
options={({navigation}) => {
|
|
|
|
const openDrawer = getDrawerButton.bind(this, navigation);
|
|
|
|
return {
|
2020-03-08 12:17:04 +01:00
|
|
|
title: i18n.t('screens.availableRooms'),
|
2020-03-06 09:12:56 +01:00
|
|
|
headerLeft: openDrawer
|
|
|
|
};
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</AvailableRoomStack.Navigator>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const BibStack = createStackNavigator();
|
|
|
|
|
|
|
|
function BibStackComponent() {
|
|
|
|
return (
|
|
|
|
<BibStack.Navigator
|
|
|
|
initialRouteName="BibScreen"
|
|
|
|
headerMode="float"
|
|
|
|
screenOptions={defaultScreenOptions}
|
|
|
|
>
|
|
|
|
<BibStack.Screen
|
|
|
|
name="BibScreen"
|
|
|
|
component={BibScreen}
|
|
|
|
options={({navigation}) => {
|
|
|
|
const openDrawer = getDrawerButton.bind(this, navigation);
|
|
|
|
return {
|
2020-03-08 12:17:04 +01:00
|
|
|
title: i18n.t('screens.bib'),
|
2020-03-06 09:12:56 +01:00
|
|
|
headerLeft: openDrawer
|
|
|
|
};
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</BibStack.Navigator>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-03-05 10:29:15 +01:00
|
|
|
const Drawer = createDrawerNavigator();
|
|
|
|
|
2020-03-06 23:15:01 +01:00
|
|
|
function getDrawerContent(props) {
|
|
|
|
return <Sidebar {...props}/>
|
2020-02-04 19:42:40 +01:00
|
|
|
}
|
|
|
|
|
2020-03-05 10:29:15 +01:00
|
|
|
export default function DrawerNavigator() {
|
|
|
|
return (
|
|
|
|
<Drawer.Navigator
|
|
|
|
initialRouteName={'Main'}
|
2020-03-06 09:12:56 +01:00
|
|
|
headerMode={'float'}
|
|
|
|
backBehavior={'initialRoute'}
|
2020-03-06 23:15:01 +01:00
|
|
|
drawerType={'front'}
|
|
|
|
drawerContent={(props) => getDrawerContent(props)}
|
2020-03-06 09:12:56 +01:00
|
|
|
screenOptions={defaultScreenOptions}
|
2020-03-05 10:29:15 +01:00
|
|
|
>
|
|
|
|
<Drawer.Screen
|
|
|
|
name="Main"
|
|
|
|
component={TabNavigator}
|
|
|
|
>
|
|
|
|
</Drawer.Screen>
|
|
|
|
<Drawer.Screen
|
|
|
|
name="SettingsScreen"
|
2020-03-06 09:12:56 +01:00
|
|
|
component={SettingsStackComponent}
|
2020-03-05 10:29:15 +01:00
|
|
|
/>
|
|
|
|
<Drawer.Screen
|
|
|
|
name="AboutScreen"
|
|
|
|
component={AboutStackComponent}
|
|
|
|
/>
|
|
|
|
<Drawer.Screen
|
|
|
|
name="SelfMenuScreen"
|
2020-03-06 09:12:56 +01:00
|
|
|
component={SelfMenuStackComponent}
|
2020-03-05 10:29:15 +01:00
|
|
|
/>
|
|
|
|
<Drawer.Screen
|
|
|
|
name="AvailableRoomScreen"
|
2020-03-06 09:12:56 +01:00
|
|
|
component={AvailableRoomStackComponent}
|
2020-03-05 10:29:15 +01:00
|
|
|
/>
|
2020-03-06 09:12:56 +01:00
|
|
|
<Drawer.Screen
|
|
|
|
name="BibScreen"
|
|
|
|
component={BibStackComponent}
|
2020-03-05 21:48:37 +01:00
|
|
|
/>
|
2020-03-06 09:12:56 +01:00
|
|
|
</Drawer.Navigator>
|
2020-03-05 21:48:37 +01:00
|
|
|
);
|
|
|
|
}
|