Improve navigators to match linter
This commit is contained in:
parent
7107a8eadf
commit
3e4f2f4ac1
2 changed files with 465 additions and 417 deletions
|
@ -1,204 +1,231 @@
|
|||
// @flow
|
||||
|
||||
import * as React from 'react';
|
||||
import {createStackNavigator, TransitionPresets} from '@react-navigation/stack';
|
||||
import i18n from 'i18n-js';
|
||||
import {Platform} from 'react-native';
|
||||
import SettingsScreen from '../screens/Other/Settings/SettingsScreen';
|
||||
import AboutScreen from '../screens/About/AboutScreen';
|
||||
import AboutDependenciesScreen from '../screens/About/AboutDependenciesScreen';
|
||||
import DebugScreen from '../screens/About/DebugScreen';
|
||||
import {createStackNavigator, TransitionPresets} from "@react-navigation/stack";
|
||||
import i18n from "i18n-js";
|
||||
import TabNavigator from "./TabNavigator";
|
||||
import GameMainScreen from "../screens/Game/screens/GameMainScreen";
|
||||
import VoteScreen from "../screens/Amicale/VoteScreen";
|
||||
import LoginScreen from "../screens/Amicale/LoginScreen";
|
||||
import {Platform} from "react-native";
|
||||
import SelfMenuScreen from "../screens/Services/SelfMenuScreen";
|
||||
import ProximoMainScreen from "../screens/Services/Proximo/ProximoMainScreen";
|
||||
import ProximoListScreen from "../screens/Services/Proximo/ProximoListScreen";
|
||||
import ProximoAboutScreen from "../screens/Services/Proximo/ProximoAboutScreen";
|
||||
import ProfileScreen from "../screens/Amicale/ProfileScreen";
|
||||
import ClubListScreen from "../screens/Amicale/Clubs/ClubListScreen";
|
||||
import ClubAboutScreen from "../screens/Amicale/Clubs/ClubAboutScreen";
|
||||
import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen";
|
||||
import {createScreenCollapsibleStack, getWebsiteStack} from "../utils/CollapsibleUtils";
|
||||
import BugReportScreen from "../screens/Other/FeedbackScreen";
|
||||
import WebsiteScreen from "../screens/Services/WebsiteScreen";
|
||||
import EquipmentScreen from "../screens/Amicale/Equipment/EquipmentListScreen";
|
||||
import EquipmentLendScreen from "../screens/Amicale/Equipment/EquipmentRentScreen";
|
||||
import EquipmentConfirmScreen from "../screens/Amicale/Equipment/EquipmentConfirmScreen";
|
||||
import DashboardEditScreen from "../screens/Other/Settings/DashboardEditScreen";
|
||||
import GameStartScreen from "../screens/Game/screens/GameStartScreen";
|
||||
import TabNavigator from './TabNavigator';
|
||||
import GameMainScreen from '../screens/Game/screens/GameMainScreen';
|
||||
import VoteScreen from '../screens/Amicale/VoteScreen';
|
||||
import LoginScreen from '../screens/Amicale/LoginScreen';
|
||||
import SelfMenuScreen from '../screens/Services/SelfMenuScreen';
|
||||
import ProximoMainScreen from '../screens/Services/Proximo/ProximoMainScreen';
|
||||
import ProximoListScreen from '../screens/Services/Proximo/ProximoListScreen';
|
||||
import ProximoAboutScreen from '../screens/Services/Proximo/ProximoAboutScreen';
|
||||
import ProfileScreen from '../screens/Amicale/ProfileScreen';
|
||||
import ClubListScreen from '../screens/Amicale/Clubs/ClubListScreen';
|
||||
import ClubAboutScreen from '../screens/Amicale/Clubs/ClubAboutScreen';
|
||||
import ClubDisplayScreen from '../screens/Amicale/Clubs/ClubDisplayScreen';
|
||||
import {
|
||||
createScreenCollapsibleStack,
|
||||
getWebsiteStack,
|
||||
} from '../utils/CollapsibleUtils';
|
||||
import BugReportScreen from '../screens/Other/FeedbackScreen';
|
||||
import WebsiteScreen from '../screens/Services/WebsiteScreen';
|
||||
import EquipmentScreen from '../screens/Amicale/Equipment/EquipmentListScreen';
|
||||
import EquipmentLendScreen from '../screens/Amicale/Equipment/EquipmentRentScreen';
|
||||
import EquipmentConfirmScreen from '../screens/Amicale/Equipment/EquipmentConfirmScreen';
|
||||
import DashboardEditScreen from '../screens/Other/Settings/DashboardEditScreen';
|
||||
import GameStartScreen from '../screens/Game/screens/GameStartScreen';
|
||||
|
||||
const modalTransition = Platform.OS === 'ios' ? TransitionPresets.ModalPresentationIOS : TransitionPresets.ModalSlideFromBottomIOS;
|
||||
const modalTransition =
|
||||
Platform.OS === 'ios'
|
||||
? TransitionPresets.ModalPresentationIOS
|
||||
: TransitionPresets.ModalSlideFromBottomIOS;
|
||||
|
||||
const defaultScreenOptions = {
|
||||
gestureEnabled: true,
|
||||
cardOverlayEnabled: true,
|
||||
...TransitionPresets.SlideFromRightIOS,
|
||||
gestureEnabled: true,
|
||||
cardOverlayEnabled: true,
|
||||
...TransitionPresets.SlideFromRightIOS,
|
||||
};
|
||||
|
||||
|
||||
const MainStack = createStackNavigator();
|
||||
|
||||
function MainStackComponent(props: { createTabNavigator: () => React.Node }) {
|
||||
return (
|
||||
<MainStack.Navigator
|
||||
initialRouteName={'main'}
|
||||
headerMode={'screen'}
|
||||
screenOptions={defaultScreenOptions}
|
||||
>
|
||||
<MainStack.Screen
|
||||
name="main"
|
||||
component={props.createTabNavigator}
|
||||
options={{
|
||||
headerShown: false,
|
||||
title: i18n.t('screens.home.title'),
|
||||
}}
|
||||
/>
|
||||
{createScreenCollapsibleStack(
|
||||
"settings",
|
||||
MainStack,
|
||||
SettingsScreen,
|
||||
i18n.t('screens.settings.title'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"dashboard-edit",
|
||||
MainStack,
|
||||
DashboardEditScreen,
|
||||
i18n.t('screens.settings.dashboardEdit.title'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"about",
|
||||
MainStack,
|
||||
AboutScreen,
|
||||
i18n.t('screens.about.title'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"dependencies",
|
||||
MainStack,
|
||||
AboutDependenciesScreen,
|
||||
i18n.t('screens.about.libs'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"debug",
|
||||
MainStack,
|
||||
DebugScreen,
|
||||
i18n.t('screens.about.debug'))}
|
||||
function MainStackComponent(props: {
|
||||
createTabNavigator: () => React.Node,
|
||||
}): React.Node {
|
||||
const {createTabNavigator} = props;
|
||||
return (
|
||||
<MainStack.Navigator
|
||||
initialRouteName="main"
|
||||
headerMode="screen"
|
||||
screenOptions={defaultScreenOptions}>
|
||||
<MainStack.Screen
|
||||
name="main"
|
||||
component={createTabNavigator}
|
||||
options={{
|
||||
headerShown: false,
|
||||
title: i18n.t('screens.home.title'),
|
||||
}}
|
||||
/>
|
||||
{createScreenCollapsibleStack(
|
||||
'settings',
|
||||
MainStack,
|
||||
SettingsScreen,
|
||||
i18n.t('screens.settings.title'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'dashboard-edit',
|
||||
MainStack,
|
||||
DashboardEditScreen,
|
||||
i18n.t('screens.settings.dashboardEdit.title'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'about',
|
||||
MainStack,
|
||||
AboutScreen,
|
||||
i18n.t('screens.about.title'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'dependencies',
|
||||
MainStack,
|
||||
AboutDependenciesScreen,
|
||||
i18n.t('screens.about.libs'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'debug',
|
||||
MainStack,
|
||||
DebugScreen,
|
||||
i18n.t('screens.about.debug'),
|
||||
)}
|
||||
|
||||
{createScreenCollapsibleStack(
|
||||
"game-start",
|
||||
MainStack,
|
||||
GameStartScreen,
|
||||
i18n.t('screens.game.title'))}
|
||||
<MainStack.Screen
|
||||
name="game-main"
|
||||
component={GameMainScreen}
|
||||
options={{
|
||||
title: i18n.t("screens.game.title"),
|
||||
}}
|
||||
/>
|
||||
{createScreenCollapsibleStack(
|
||||
"login",
|
||||
MainStack,
|
||||
LoginScreen,
|
||||
i18n.t('screens.login.title'),
|
||||
true,
|
||||
{headerTintColor: "#fff"},
|
||||
'transparent')}
|
||||
{getWebsiteStack("website", MainStack, WebsiteScreen, "")}
|
||||
{createScreenCollapsibleStack(
|
||||
'game-start',
|
||||
MainStack,
|
||||
GameStartScreen,
|
||||
i18n.t('screens.game.title'),
|
||||
)}
|
||||
<MainStack.Screen
|
||||
name="game-main"
|
||||
component={GameMainScreen}
|
||||
options={{
|
||||
title: i18n.t('screens.game.title'),
|
||||
}}
|
||||
/>
|
||||
{createScreenCollapsibleStack(
|
||||
'login',
|
||||
MainStack,
|
||||
LoginScreen,
|
||||
i18n.t('screens.login.title'),
|
||||
true,
|
||||
{headerTintColor: '#fff'},
|
||||
'transparent',
|
||||
)}
|
||||
{getWebsiteStack('website', MainStack, WebsiteScreen, '')}
|
||||
|
||||
{createScreenCollapsibleStack(
|
||||
'self-menu',
|
||||
MainStack,
|
||||
SelfMenuScreen,
|
||||
i18n.t('screens.menu.title'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'proximo',
|
||||
MainStack,
|
||||
ProximoMainScreen,
|
||||
i18n.t('screens.proximo.title'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'proximo-list',
|
||||
MainStack,
|
||||
ProximoListScreen,
|
||||
i18n.t('screens.proximo.articleList'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'proximo-about',
|
||||
MainStack,
|
||||
ProximoAboutScreen,
|
||||
i18n.t('screens.proximo.title'),
|
||||
true,
|
||||
{...modalTransition},
|
||||
)}
|
||||
|
||||
{createScreenCollapsibleStack(
|
||||
"self-menu",
|
||||
MainStack,
|
||||
SelfMenuScreen,
|
||||
i18n.t('screens.menu.title'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"proximo",
|
||||
MainStack,
|
||||
ProximoMainScreen,
|
||||
i18n.t('screens.proximo.title'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"proximo-list",
|
||||
MainStack,
|
||||
ProximoListScreen,
|
||||
i18n.t('screens.proximo.articleList'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
"proximo-about",
|
||||
MainStack,
|
||||
ProximoAboutScreen,
|
||||
i18n.t('screens.proximo.title'),
|
||||
true,
|
||||
{...modalTransition},
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'profile',
|
||||
MainStack,
|
||||
ProfileScreen,
|
||||
i18n.t('screens.profile.title'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'club-list',
|
||||
MainStack,
|
||||
ClubListScreen,
|
||||
i18n.t('screens.clubs.title'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'club-information',
|
||||
MainStack,
|
||||
ClubDisplayScreen,
|
||||
i18n.t('screens.clubs.details'),
|
||||
true,
|
||||
{...modalTransition},
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'club-about',
|
||||
MainStack,
|
||||
ClubAboutScreen,
|
||||
i18n.t('screens.clubs.title'),
|
||||
true,
|
||||
{...modalTransition},
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'equipment-list',
|
||||
MainStack,
|
||||
EquipmentScreen,
|
||||
i18n.t('screens.equipment.title'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'equipment-rent',
|
||||
MainStack,
|
||||
EquipmentLendScreen,
|
||||
i18n.t('screens.equipment.book'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'equipment-confirm',
|
||||
MainStack,
|
||||
EquipmentConfirmScreen,
|
||||
i18n.t('screens.equipment.confirm'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'vote',
|
||||
MainStack,
|
||||
VoteScreen,
|
||||
i18n.t('screens.vote.title'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'feedback',
|
||||
MainStack,
|
||||
BugReportScreen,
|
||||
i18n.t('screens.feedback.title'),
|
||||
)}
|
||||
</MainStack.Navigator>
|
||||
);
|
||||
}
|
||||
|
||||
{createScreenCollapsibleStack(
|
||||
"profile",
|
||||
MainStack,
|
||||
ProfileScreen,
|
||||
i18n.t('screens.profile.title'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"club-list",
|
||||
MainStack,
|
||||
ClubListScreen,
|
||||
i18n.t('screens.clubs.title'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"club-information",
|
||||
MainStack,
|
||||
ClubDisplayScreen,
|
||||
i18n.t('screens.clubs.details'),
|
||||
true,
|
||||
{...modalTransition})}
|
||||
{createScreenCollapsibleStack(
|
||||
"club-about",
|
||||
MainStack,
|
||||
ClubAboutScreen,
|
||||
i18n.t('screens.clubs.title'),
|
||||
true,
|
||||
{...modalTransition})}
|
||||
{createScreenCollapsibleStack(
|
||||
"equipment-list",
|
||||
MainStack,
|
||||
EquipmentScreen,
|
||||
i18n.t('screens.equipment.title'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"equipment-rent",
|
||||
MainStack,
|
||||
EquipmentLendScreen,
|
||||
i18n.t('screens.equipment.book'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"equipment-confirm",
|
||||
MainStack,
|
||||
EquipmentConfirmScreen,
|
||||
i18n.t('screens.equipment.confirm'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"vote",
|
||||
MainStack,
|
||||
VoteScreen,
|
||||
i18n.t('screens.vote.title'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"feedback",
|
||||
MainStack,
|
||||
BugReportScreen,
|
||||
i18n.t('screens.feedback.title'))}
|
||||
</MainStack.Navigator>
|
||||
type PropsType = {
|
||||
defaultHomeRoute: string | null,
|
||||
// eslint-disable-next-line flowtype/no-weak-types
|
||||
defaultHomeData: {[key: string]: string},
|
||||
};
|
||||
|
||||
export default class MainNavigator extends React.Component<PropsType> {
|
||||
createTabNavigator: () => React.Node;
|
||||
|
||||
constructor(props: PropsType) {
|
||||
super(props);
|
||||
this.createTabNavigator = (): React.Node => (
|
||||
<TabNavigator
|
||||
defaultHomeRoute={props.defaultHomeRoute}
|
||||
defaultHomeData={props.defaultHomeData}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
type Props = {
|
||||
defaultHomeRoute: string | null,
|
||||
defaultHomeData: { [key: string]: any }
|
||||
}
|
||||
|
||||
export default class MainNavigator extends React.Component<Props> {
|
||||
|
||||
createTabNavigator: () => React.Node;
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.createTabNavigator = () => <TabNavigator {...props}/>
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<MainStackComponent createTabNavigator={this.createTabNavigator}/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
render(): React.Node {
|
||||
return <MainStackComponent createTabNavigator={this.createTabNavigator} />;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,271 +1,292 @@
|
|||
// @flow
|
||||
|
||||
import * as React from 'react';
|
||||
import {createStackNavigator, TransitionPresets} from '@react-navigation/stack';
|
||||
import {createBottomTabNavigator} from "@react-navigation/bottom-tabs";
|
||||
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
|
||||
|
||||
import {Title, useTheme} from 'react-native-paper';
|
||||
import {Platform} from 'react-native';
|
||||
import i18n from 'i18n-js';
|
||||
import {createCollapsibleStack} from 'react-navigation-collapsible';
|
||||
import {View} from 'react-native-animatable';
|
||||
import HomeScreen from '../screens/Home/HomeScreen';
|
||||
import PlanningScreen from '../screens/Planning/PlanningScreen';
|
||||
import PlanningDisplayScreen from '../screens/Planning/PlanningDisplayScreen';
|
||||
import ProxiwashScreen from '../screens/Proxiwash/ProxiwashScreen';
|
||||
import ProxiwashAboutScreen from '../screens/Proxiwash/ProxiwashAboutScreen';
|
||||
import PlanexScreen from '../screens/Planex/PlanexScreen';
|
||||
import AsyncStorageManager from "../managers/AsyncStorageManager";
|
||||
import {Title, useTheme} from 'react-native-paper';
|
||||
import {Platform} from 'react-native';
|
||||
import i18n from "i18n-js";
|
||||
import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen";
|
||||
import ScannerScreen from "../screens/Home/ScannerScreen";
|
||||
import FeedItemScreen from "../screens/Home/FeedItemScreen";
|
||||
import {createCollapsibleStack} from "react-navigation-collapsible";
|
||||
import GroupSelectionScreen from "../screens/Planex/GroupSelectionScreen";
|
||||
import CustomTabBar from "../components/Tabbar/CustomTabBar";
|
||||
import WebsitesHomeScreen from "../screens/Services/ServicesScreen";
|
||||
import ServicesSectionScreen from "../screens/Services/ServicesSectionScreen";
|
||||
import AmicaleContactScreen from "../screens/Amicale/AmicaleContactScreen";
|
||||
import {createScreenCollapsibleStack, getWebsiteStack} from "../utils/CollapsibleUtils";
|
||||
import {View} from "react-native-animatable";
|
||||
import Mascot, {MASCOT_STYLE} from "../components/Mascot/Mascot";
|
||||
|
||||
const modalTransition = Platform.OS === 'ios' ? TransitionPresets.ModalPresentationIOS : TransitionPresets.ModalSlideFromBottomIOS;
|
||||
import AsyncStorageManager from '../managers/AsyncStorageManager';
|
||||
import ClubDisplayScreen from '../screens/Amicale/Clubs/ClubDisplayScreen';
|
||||
import ScannerScreen from '../screens/Home/ScannerScreen';
|
||||
import FeedItemScreen from '../screens/Home/FeedItemScreen';
|
||||
import GroupSelectionScreen from '../screens/Planex/GroupSelectionScreen';
|
||||
import CustomTabBar from '../components/Tabbar/CustomTabBar';
|
||||
import WebsitesHomeScreen from '../screens/Services/ServicesScreen';
|
||||
import ServicesSectionScreen from '../screens/Services/ServicesSectionScreen';
|
||||
import AmicaleContactScreen from '../screens/Amicale/AmicaleContactScreen';
|
||||
import {
|
||||
createScreenCollapsibleStack,
|
||||
getWebsiteStack,
|
||||
} from '../utils/CollapsibleUtils';
|
||||
import Mascot, {MASCOT_STYLE} from '../components/Mascot/Mascot';
|
||||
|
||||
const modalTransition =
|
||||
Platform.OS === 'ios'
|
||||
? TransitionPresets.ModalPresentationIOS
|
||||
: TransitionPresets.ModalSlideFromBottomIOS;
|
||||
|
||||
const defaultScreenOptions = {
|
||||
gestureEnabled: true,
|
||||
cardOverlayEnabled: true,
|
||||
...modalTransition,
|
||||
gestureEnabled: true,
|
||||
cardOverlayEnabled: true,
|
||||
...modalTransition,
|
||||
};
|
||||
|
||||
|
||||
const ServicesStack = createStackNavigator();
|
||||
|
||||
function ServicesStackComponent() {
|
||||
return (
|
||||
<ServicesStack.Navigator
|
||||
initialRouteName="index"
|
||||
headerMode={"screen"}
|
||||
screenOptions={defaultScreenOptions}
|
||||
>
|
||||
{createScreenCollapsibleStack(
|
||||
"index",
|
||||
ServicesStack,
|
||||
WebsitesHomeScreen,
|
||||
i18n.t('screens.services.title'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"services-section",
|
||||
ServicesStack,
|
||||
ServicesSectionScreen,
|
||||
"SECTION")}
|
||||
{createScreenCollapsibleStack(
|
||||
"amicale-contact",
|
||||
ServicesStack,
|
||||
AmicaleContactScreen,
|
||||
i18n.t('screens.amicaleAbout.title'))}
|
||||
</ServicesStack.Navigator>
|
||||
);
|
||||
function ServicesStackComponent(): React.Node {
|
||||
return (
|
||||
<ServicesStack.Navigator
|
||||
initialRouteName="index"
|
||||
headerMode="screen"
|
||||
screenOptions={defaultScreenOptions}>
|
||||
{createScreenCollapsibleStack(
|
||||
'index',
|
||||
ServicesStack,
|
||||
WebsitesHomeScreen,
|
||||
i18n.t('screens.services.title'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'services-section',
|
||||
ServicesStack,
|
||||
ServicesSectionScreen,
|
||||
'SECTION',
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'amicale-contact',
|
||||
ServicesStack,
|
||||
AmicaleContactScreen,
|
||||
i18n.t('screens.amicaleAbout.title'),
|
||||
)}
|
||||
</ServicesStack.Navigator>
|
||||
);
|
||||
}
|
||||
|
||||
const ProxiwashStack = createStackNavigator();
|
||||
|
||||
function ProxiwashStackComponent() {
|
||||
return (
|
||||
<ProxiwashStack.Navigator
|
||||
initialRouteName="index"
|
||||
headerMode={"screen"}
|
||||
screenOptions={defaultScreenOptions}
|
||||
>
|
||||
{createScreenCollapsibleStack(
|
||||
"index",
|
||||
ProxiwashStack,
|
||||
ProxiwashScreen,
|
||||
i18n.t('screens.proxiwash.title'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"proxiwash-about",
|
||||
ProxiwashStack,
|
||||
ProxiwashAboutScreen,
|
||||
i18n.t('screens.proxiwash.title'))}
|
||||
</ProxiwashStack.Navigator>
|
||||
);
|
||||
function ProxiwashStackComponent(): React.Node {
|
||||
return (
|
||||
<ProxiwashStack.Navigator
|
||||
initialRouteName="index"
|
||||
headerMode="screen"
|
||||
screenOptions={defaultScreenOptions}>
|
||||
{createScreenCollapsibleStack(
|
||||
'index',
|
||||
ProxiwashStack,
|
||||
ProxiwashScreen,
|
||||
i18n.t('screens.proxiwash.title'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'proxiwash-about',
|
||||
ProxiwashStack,
|
||||
ProxiwashAboutScreen,
|
||||
i18n.t('screens.proxiwash.title'),
|
||||
)}
|
||||
</ProxiwashStack.Navigator>
|
||||
);
|
||||
}
|
||||
|
||||
const PlanningStack = createStackNavigator();
|
||||
|
||||
function PlanningStackComponent() {
|
||||
return (
|
||||
<PlanningStack.Navigator
|
||||
initialRouteName="index"
|
||||
headerMode={"screen"}
|
||||
screenOptions={defaultScreenOptions}
|
||||
>
|
||||
<PlanningStack.Screen
|
||||
name="index"
|
||||
component={PlanningScreen}
|
||||
options={{title: i18n.t('screens.planning.title'),}}
|
||||
/>
|
||||
{createScreenCollapsibleStack(
|
||||
"planning-information",
|
||||
PlanningStack,
|
||||
PlanningDisplayScreen,
|
||||
i18n.t('screens.planning.eventDetails'))}
|
||||
</PlanningStack.Navigator>
|
||||
);
|
||||
function PlanningStackComponent(): React.Node {
|
||||
return (
|
||||
<PlanningStack.Navigator
|
||||
initialRouteName="index"
|
||||
headerMode="screen"
|
||||
screenOptions={defaultScreenOptions}>
|
||||
<PlanningStack.Screen
|
||||
name="index"
|
||||
component={PlanningScreen}
|
||||
options={{title: i18n.t('screens.planning.title')}}
|
||||
/>
|
||||
{createScreenCollapsibleStack(
|
||||
'planning-information',
|
||||
PlanningStack,
|
||||
PlanningDisplayScreen,
|
||||
i18n.t('screens.planning.eventDetails'),
|
||||
)}
|
||||
</PlanningStack.Navigator>
|
||||
);
|
||||
}
|
||||
|
||||
const HomeStack = createStackNavigator();
|
||||
|
||||
function HomeStackComponent(initialRoute: string | null, defaultData: { [key: string]: any }) {
|
||||
let params = undefined;
|
||||
if (initialRoute != null)
|
||||
params = {data: defaultData, nextScreen: initialRoute, shouldOpen: true};
|
||||
const {colors} = useTheme();
|
||||
return (
|
||||
<HomeStack.Navigator
|
||||
initialRouteName={"index"}
|
||||
headerMode={"screen"}
|
||||
screenOptions={defaultScreenOptions}
|
||||
>
|
||||
{createCollapsibleStack(
|
||||
<HomeStack.Screen
|
||||
name="index"
|
||||
component={HomeScreen}
|
||||
options={{
|
||||
title: i18n.t('screens.home.title'),
|
||||
headerStyle: {
|
||||
backgroundColor: colors.surface,
|
||||
},
|
||||
headerTitle: () =>
|
||||
<View style={{flexDirection: "row"}}>
|
||||
<Mascot
|
||||
style={{
|
||||
width: 50
|
||||
}}
|
||||
emotion={MASCOT_STYLE.RANDOM}
|
||||
animated={true}
|
||||
entryAnimation={{
|
||||
animation: "bounceIn",
|
||||
duration: 1000
|
||||
}}
|
||||
loopAnimation={{
|
||||
animation: "pulse",
|
||||
duration: 2000,
|
||||
iterationCount: "infinite"
|
||||
}}
|
||||
/>
|
||||
<Title style={{
|
||||
marginLeft: 10,
|
||||
marginTop: "auto",
|
||||
marginBottom: "auto",
|
||||
}}>{i18n.t('screens.home.title')}</Title>
|
||||
</View>
|
||||
}}
|
||||
initialParams={params}
|
||||
/>,
|
||||
{
|
||||
collapsedColor: colors.surface,
|
||||
useNativeDriver: true,
|
||||
}
|
||||
)}
|
||||
<HomeStack.Screen
|
||||
name="scanner"
|
||||
component={ScannerScreen}
|
||||
options={{title: i18n.t('screens.scanner.title'),}}
|
||||
/>
|
||||
function HomeStackComponent(
|
||||
initialRoute: string | null,
|
||||
defaultData: {[key: string]: string},
|
||||
): React.Node {
|
||||
let params;
|
||||
if (initialRoute != null)
|
||||
params = {data: defaultData, nextScreen: initialRoute, shouldOpen: true};
|
||||
const {colors} = useTheme();
|
||||
return (
|
||||
<HomeStack.Navigator
|
||||
initialRouteName="index"
|
||||
headerMode="screen"
|
||||
screenOptions={defaultScreenOptions}>
|
||||
{createCollapsibleStack(
|
||||
<HomeStack.Screen
|
||||
name="index"
|
||||
component={HomeScreen}
|
||||
options={{
|
||||
title: i18n.t('screens.home.title'),
|
||||
headerStyle: {
|
||||
backgroundColor: colors.surface,
|
||||
},
|
||||
headerTitle: (): React.Node => (
|
||||
<View style={{flexDirection: 'row'}}>
|
||||
<Mascot
|
||||
style={{
|
||||
width: 50,
|
||||
}}
|
||||
emotion={MASCOT_STYLE.RANDOM}
|
||||
animated
|
||||
entryAnimation={{
|
||||
animation: 'bounceIn',
|
||||
duration: 1000,
|
||||
}}
|
||||
loopAnimation={{
|
||||
animation: 'pulse',
|
||||
duration: 2000,
|
||||
iterationCount: 'infinite',
|
||||
}}
|
||||
/>
|
||||
<Title
|
||||
style={{
|
||||
marginLeft: 10,
|
||||
marginTop: 'auto',
|
||||
marginBottom: 'auto',
|
||||
}}>
|
||||
{i18n.t('screens.home.title')}
|
||||
</Title>
|
||||
</View>
|
||||
),
|
||||
}}
|
||||
initialParams={params}
|
||||
/>,
|
||||
{
|
||||
collapsedColor: colors.surface,
|
||||
useNativeDriver: true,
|
||||
},
|
||||
)}
|
||||
<HomeStack.Screen
|
||||
name="scanner"
|
||||
component={ScannerScreen}
|
||||
options={{title: i18n.t('screens.scanner.title')}}
|
||||
/>
|
||||
|
||||
{createScreenCollapsibleStack(
|
||||
"club-information",
|
||||
HomeStack,
|
||||
ClubDisplayScreen,
|
||||
i18n.t('screens.clubs.details'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"feed-information",
|
||||
HomeStack,
|
||||
FeedItemScreen,
|
||||
i18n.t('screens.home.feed'))}
|
||||
{createScreenCollapsibleStack(
|
||||
"planning-information",
|
||||
HomeStack,
|
||||
PlanningDisplayScreen,
|
||||
i18n.t('screens.planning.eventDetails'))}
|
||||
</HomeStack.Navigator>
|
||||
);
|
||||
{createScreenCollapsibleStack(
|
||||
'club-information',
|
||||
HomeStack,
|
||||
ClubDisplayScreen,
|
||||
i18n.t('screens.clubs.details'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'feed-information',
|
||||
HomeStack,
|
||||
FeedItemScreen,
|
||||
i18n.t('screens.home.feed'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'planning-information',
|
||||
HomeStack,
|
||||
PlanningDisplayScreen,
|
||||
i18n.t('screens.planning.eventDetails'),
|
||||
)}
|
||||
</HomeStack.Navigator>
|
||||
);
|
||||
}
|
||||
|
||||
const PlanexStack = createStackNavigator();
|
||||
|
||||
function PlanexStackComponent() {
|
||||
return (
|
||||
<PlanexStack.Navigator
|
||||
initialRouteName="index"
|
||||
headerMode={"screen"}
|
||||
screenOptions={defaultScreenOptions}
|
||||
>
|
||||
{getWebsiteStack(
|
||||
"index",
|
||||
PlanexStack,
|
||||
PlanexScreen,
|
||||
i18n.t("screens.planex.title"))}
|
||||
{createScreenCollapsibleStack(
|
||||
"group-select",
|
||||
PlanexStack,
|
||||
GroupSelectionScreen,
|
||||
"")}
|
||||
</PlanexStack.Navigator>
|
||||
);
|
||||
function PlanexStackComponent(): React.Node {
|
||||
return (
|
||||
<PlanexStack.Navigator
|
||||
initialRouteName="index"
|
||||
headerMode="screen"
|
||||
screenOptions={defaultScreenOptions}>
|
||||
{getWebsiteStack(
|
||||
'index',
|
||||
PlanexStack,
|
||||
PlanexScreen,
|
||||
i18n.t('screens.planex.title'),
|
||||
)}
|
||||
{createScreenCollapsibleStack(
|
||||
'group-select',
|
||||
PlanexStack,
|
||||
GroupSelectionScreen,
|
||||
'',
|
||||
)}
|
||||
</PlanexStack.Navigator>
|
||||
);
|
||||
}
|
||||
|
||||
const Tab = createBottomTabNavigator();
|
||||
|
||||
type Props = {
|
||||
defaultHomeRoute: string | null,
|
||||
defaultHomeData: { [key: string]: any }
|
||||
}
|
||||
|
||||
export default class TabNavigator extends React.Component<Props> {
|
||||
|
||||
createHomeStackComponent: () => HomeStackComponent;
|
||||
defaultRoute: string;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
if (props.defaultHomeRoute != null)
|
||||
this.defaultRoute = 'home';
|
||||
else
|
||||
this.defaultRoute = AsyncStorageManager.getString(AsyncStorageManager.PREFERENCES.defaultStartScreen.key).toLowerCase();
|
||||
this.createHomeStackComponent = () => HomeStackComponent(props.defaultHomeRoute, props.defaultHomeData);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Tab.Navigator
|
||||
initialRouteName={this.defaultRoute}
|
||||
tabBar={props => <CustomTabBar {...props} />}
|
||||
>
|
||||
<Tab.Screen
|
||||
name="services"
|
||||
option
|
||||
component={ServicesStackComponent}
|
||||
options={{title: i18n.t('screens.services.title')}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="proxiwash"
|
||||
component={ProxiwashStackComponent}
|
||||
options={{title: i18n.t('screens.proxiwash.title')}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="home"
|
||||
component={this.createHomeStackComponent}
|
||||
options={{title: i18n.t('screens.home.title')}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="planning"
|
||||
component={PlanningStackComponent}
|
||||
options={{title: i18n.t('screens.planning.title')}}
|
||||
/>
|
||||
|
||||
<Tab.Screen
|
||||
name="planex"
|
||||
component={PlanexStackComponent}
|
||||
options={{title: i18n.t("screens.planex.title")}}
|
||||
/>
|
||||
</Tab.Navigator>
|
||||
);
|
||||
}
|
||||
type PropsType = {
|
||||
defaultHomeRoute: string | null,
|
||||
defaultHomeData: {[key: string]: string},
|
||||
};
|
||||
|
||||
export default class TabNavigator extends React.Component<PropsType> {
|
||||
createHomeStackComponent: () => React.Node;
|
||||
|
||||
defaultRoute: string;
|
||||
|
||||
constructor(props: PropsType) {
|
||||
super(props);
|
||||
if (props.defaultHomeRoute != null) this.defaultRoute = 'home';
|
||||
else
|
||||
this.defaultRoute = AsyncStorageManager.getString(
|
||||
AsyncStorageManager.PREFERENCES.defaultStartScreen.key,
|
||||
).toLowerCase();
|
||||
this.createHomeStackComponent = (): React.Node =>
|
||||
HomeStackComponent(props.defaultHomeRoute, props.defaultHomeData);
|
||||
}
|
||||
|
||||
render(): React.Node {
|
||||
return (
|
||||
<Tab.Navigator
|
||||
initialRouteName={this.defaultRoute}
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
tabBar={(props: {...}): React.Node => <CustomTabBar {...props} />}>
|
||||
<Tab.Screen
|
||||
name="services"
|
||||
option
|
||||
component={ServicesStackComponent}
|
||||
options={{title: i18n.t('screens.services.title')}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="proxiwash"
|
||||
component={ProxiwashStackComponent}
|
||||
options={{title: i18n.t('screens.proxiwash.title')}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="home"
|
||||
component={this.createHomeStackComponent}
|
||||
options={{title: i18n.t('screens.home.title')}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="planning"
|
||||
component={PlanningStackComponent}
|
||||
options={{title: i18n.t('screens.planning.title')}}
|
||||
/>
|
||||
|
||||
<Tab.Screen
|
||||
name="planex"
|
||||
component={PlanexStackComponent}
|
||||
options={{title: i18n.t('screens.planex.title')}}
|
||||
/>
|
||||
</Tab.Navigator>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue