forked from vergnet/application-amicale
		
	Removed drawer and put all links in home screen
This commit is contained in:
		
							parent
							
								
									8943dcadcb
								
							
						
					
					
						commit
						c37e052aa2
					
				
					 8 changed files with 503 additions and 377 deletions
				
			
		|  | @ -1,12 +1,13 @@ | ||||||
| // @flow
 | // @flow
 | ||||||
| 
 | 
 | ||||||
| import * as React from 'react'; | import * as React from 'react'; | ||||||
| import {Button, Card, withTheme} from 'react-native-paper'; | import {Avatar, Card, List, withTheme} from 'react-native-paper'; | ||||||
| import {Platform, StyleSheet} from "react-native"; | import {StyleSheet} from "react-native"; | ||||||
| import i18n from 'i18n-js'; |  | ||||||
| import {DrawerNavigationProp} from "@react-navigation/drawer"; | import {DrawerNavigationProp} from "@react-navigation/drawer"; | ||||||
| import type {CustomTheme} from "../../managers/ThemeManager"; | import type {CustomTheme} from "../../managers/ThemeManager"; | ||||||
| 
 | 
 | ||||||
|  | const ICON_AMICALE = require("../../../assets/amicale.png"); | ||||||
|  | 
 | ||||||
| type Props = { | type Props = { | ||||||
|     navigation: DrawerNavigationProp, |     navigation: DrawerNavigationProp, | ||||||
|     theme: CustomTheme, |     theme: CustomTheme, | ||||||
|  | @ -18,45 +19,37 @@ class ActionsDashBoardItem extends React.Component<Props> { | ||||||
|         return (nextProps.theme.dark !== this.props.theme.dark) |         return (nextProps.theme.dark !== this.props.theme.dark) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     openDrawer = () => this.props.navigation.openDrawer(); |  | ||||||
| 
 |  | ||||||
|     gotToSettings = () => this.props.navigation.navigate("settings"); |  | ||||||
| 
 |  | ||||||
|     render() { |     render() { | ||||||
|         return ( |         return ( | ||||||
|             <Card style={{ |             <Card style={{ | ||||||
|                 ...styles.card, |                 ...styles.card, | ||||||
|                 borderColor: this.props.theme.colors.primary, |                 borderColor: this.props.theme.colors.primary, | ||||||
|             }}> |             }}> | ||||||
|                 <Card.Content style={styles.content}> |                 <List.Item | ||||||
|                     <Button |                     title={"AMICALE"} | ||||||
|                         icon="information" |                     description={"VOTRE COMPTE"} | ||||||
|                         mode="contained" |                     left={props => <Avatar.Image | ||||||
|                         onPress={this.openDrawer} |                         {...props} | ||||||
|                         style={styles.servicesButton} |                         size={54} | ||||||
|                     > |                         source={ICON_AMICALE} | ||||||
|                         {i18n.t("homeScreen.servicesButton")} |                         style={styles.avatar}/>} | ||||||
|                     </Button> |                     right={props => <List.Icon {...props} icon="chevron-right"/>} | ||||||
|                     { |                     onPress={() => this.props.navigation.navigate("amicale-home")} | ||||||
|                         // Leave space to fix ios icon position
 |                 /> | ||||||
|                         Platform.OS === 'ios' |                 <List.Item | ||||||
|                             ? <Button |                     title={"STUDENT WEBSITES"} | ||||||
|                                 icon="settings" |                     description={"TROP COOL"} | ||||||
|                                 mode="contained" |                     left={props => <List.Icon {...props} icon="web"/>} | ||||||
|                                 onPress={this.gotToSettings} |                     right={props => <List.Icon {...props} icon="chevron-right"/>} | ||||||
|                                 style={styles.settingsButton} |                     onPress={() => this.props.navigation.navigate("websites-home")} | ||||||
|                                 compact |                 /> | ||||||
|                             > </Button> |                 <List.Item | ||||||
|                             : <Button |                     title={"SERVICES INSA"} | ||||||
|                                 icon="settings" |                     description={"TROP BIEN"} | ||||||
|                                 mode="contained" |                     left={props => <List.Icon {...props} icon="star"/>} | ||||||
|                                 onPress={this.gotToSettings} |                     right={props => <List.Icon {...props} icon="chevron-right"/>} | ||||||
|                                 style={styles.settingsButton} |                     onPress={() => this.props.navigation.navigate("insa-home")} | ||||||
|                                 compact |                 /> | ||||||
|                             /> |  | ||||||
|                     } |  | ||||||
| 
 |  | ||||||
|                 </Card.Content> |  | ||||||
|             </Card> |             </Card> | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
|  | @ -68,25 +61,12 @@ const styles = StyleSheet.create({ | ||||||
|         marginLeft: 10, |         marginLeft: 10, | ||||||
|         marginRight: 10, |         marginRight: 10, | ||||||
|         marginTop: 10, |         marginTop: 10, | ||||||
|         overflow: 'hidden', |  | ||||||
|         elevation: 4, |         elevation: 4, | ||||||
|         borderWidth: 1, |         borderWidth: 1, | ||||||
|     }, |     }, | ||||||
|     avatar: { |     avatar: { | ||||||
|         backgroundColor: 'transparent' |         backgroundColor: 'transparent' | ||||||
|     }, |     }, | ||||||
|     content: { |  | ||||||
|         flex: 1, |  | ||||||
|         flexDirection: 'row', |  | ||||||
|     }, |  | ||||||
|     servicesButton: { |  | ||||||
|         marginLeft: 'auto', |  | ||||||
|         marginRight: 5, |  | ||||||
|     }, |  | ||||||
|     settingsButton: { |  | ||||||
|         marginLeft: 5, |  | ||||||
|         marginRight: 'auto', |  | ||||||
|     } |  | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| export default withTheme(ActionsDashBoardItem); | export default withTheme(ActionsDashBoardItem); | ||||||
|  |  | ||||||
|  | @ -1,31 +1,12 @@ | ||||||
| // @flow
 | // @flow
 | ||||||
| 
 | 
 | ||||||
| import * as React from 'react'; | import * as React from 'react'; | ||||||
| import {createDrawerNavigator, DrawerNavigationProp} from '@react-navigation/drawer'; |  | ||||||
| import SettingsScreen from '../screens/Other/SettingsScreen'; | import SettingsScreen from '../screens/Other/SettingsScreen'; | ||||||
| import AboutScreen from '../screens/About/AboutScreen'; | import AboutScreen from '../screens/About/AboutScreen'; | ||||||
| import AboutDependenciesScreen from '../screens/About/AboutDependenciesScreen'; | import AboutDependenciesScreen from '../screens/About/AboutDependenciesScreen'; | ||||||
| import SelfMenuScreen from '../screens/Other/SelfMenuScreen'; |  | ||||||
| import AvailableRoomScreen from "../screens/Websites/AvailableRoomScreen"; |  | ||||||
| import BibScreen from "../screens/Websites/BibScreen"; |  | ||||||
| import TetrisScreen from "../screens/Tetris/TetrisScreen"; |  | ||||||
| import DebugScreen from '../screens/About/DebugScreen'; | import DebugScreen from '../screens/About/DebugScreen'; | ||||||
| import Sidebar from "../components/Sidebar/Sidebar"; |  | ||||||
| import {createStackNavigator, TransitionPresets} from "@react-navigation/stack"; | import {createStackNavigator, TransitionPresets} from "@react-navigation/stack"; | ||||||
| import i18n from "i18n-js"; | import i18n from "i18n-js"; | ||||||
| import LoginScreen from "../screens/Amicale/LoginScreen"; |  | ||||||
| import ProfileScreen from "../screens/Amicale/ProfileScreen"; |  | ||||||
| import ClubListScreen from "../screens/Amicale/Clubs/ClubListScreen"; |  | ||||||
| import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen"; |  | ||||||
| import ClubAboutScreen from "../screens/Amicale/Clubs/ClubAboutScreen"; |  | ||||||
| import VoteScreen from "../screens/Amicale/VoteScreen"; |  | ||||||
| import AmicaleContactScreen from "../screens/Amicale/AmicaleContactScreen"; |  | ||||||
| import {AmicaleWebsiteScreen} from "../screens/Websites/AmicaleWebsiteScreen"; |  | ||||||
| import {TutorInsaWebsiteScreen} from "../screens/Websites/TutorInsaWebsiteScreen"; |  | ||||||
| import {WiketudWebsiteScreen} from "../screens/Websites/WiketudWebsiteScreen"; |  | ||||||
| import {ElusEtudiantsWebsiteScreen} from "../screens/Websites/ElusEtudiantsWebsiteScreen"; |  | ||||||
| import {createCollapsibleStack} from "react-navigation-collapsible"; |  | ||||||
| import {useTheme} from "react-native-paper"; |  | ||||||
| import TabNavigator from "./MainTabNavigator"; | import TabNavigator from "./MainTabNavigator"; | ||||||
| 
 | 
 | ||||||
| const defaultScreenOptions = { | const defaultScreenOptions = { | ||||||
|  | @ -34,139 +15,54 @@ const defaultScreenOptions = { | ||||||
|     ...TransitionPresets.SlideFromRightIOS, |     ...TransitionPresets.SlideFromRightIOS, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| function createScreenCollapsibleStack (name: string, component: any, title: string, useNativeDriver?: boolean) { | const MainStack = createStackNavigator(); | ||||||
|     const {colors} = useTheme(); | 
 | ||||||
|     return createCollapsibleStack( | function MainStackComponent(props: { createTabNavigator: () => React.Node }) { | ||||||
|         <DrawerStack.Screen |     return ( | ||||||
|             name={name} |         <MainStack.Navigator | ||||||
|             component={component} |             initialRouteName={'main'} | ||||||
|             options={{ |             headerMode={'screen'} | ||||||
|                 title: title, |             screenOptions={defaultScreenOptions} | ||||||
|                 headerStyle: { |         > | ||||||
|                     backgroundColor: colors.surface, |             <MainStack.Screen | ||||||
|                 }, |                 name="main" | ||||||
|             }} |                 component={props.createTabNavigator} | ||||||
|         />, |                 options={{ | ||||||
|         { |                     headerShown: false, | ||||||
|             collapsedColor: 'transparent', |                 }} | ||||||
|             useNativeDriver: useNativeDriver != null ? useNativeDriver : true, // native driver does not work with webview
 |             /> | ||||||
|         } |             <MainStack.Screen | ||||||
|     ) |                 name="settings" | ||||||
|  |                 component={SettingsScreen} | ||||||
|  |                 options={{ | ||||||
|  |                     title: i18n.t('screens.settings'), | ||||||
|  |                 }} | ||||||
|  |             /> | ||||||
|  |             <MainStack.Screen | ||||||
|  |                 name="about" | ||||||
|  |                 component={AboutScreen} | ||||||
|  |                 options={{ | ||||||
|  |                     title: i18n.t('screens.about'), | ||||||
|  |                 }} | ||||||
|  |             /> | ||||||
|  |             <MainStack.Screen | ||||||
|  |                 name="dependencies" | ||||||
|  |                 component={AboutDependenciesScreen} | ||||||
|  |                 options={{ | ||||||
|  |                     title: i18n.t('aboutScreen.libs') | ||||||
|  |                 }} | ||||||
|  |             /> | ||||||
|  |             <MainStack.Screen | ||||||
|  |                 name="debug" | ||||||
|  |                 component={DebugScreen} | ||||||
|  |                 options={{ | ||||||
|  |                     title: i18n.t('aboutScreen.debug') | ||||||
|  |                 }} | ||||||
|  |             /> | ||||||
|  |         </MainStack.Navigator> | ||||||
|  |     ); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function getWebsiteStack(name: string, component: any, title: string) { |  | ||||||
|     return createScreenCollapsibleStack(name, component, title, false); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const DrawerStack = createStackNavigator(); |  | ||||||
| 
 |  | ||||||
| function DrawerStackComponent(props) { |  | ||||||
|         return ( |  | ||||||
|             <DrawerStack.Navigator |  | ||||||
|                 initialRouteName={'main'} |  | ||||||
|                 headerMode={'screen'} |  | ||||||
|                 screenOptions={defaultScreenOptions} |  | ||||||
|             > |  | ||||||
|                 <DrawerStack.Screen |  | ||||||
|                     name="main" |  | ||||||
|                     component={props.createTabNavigator} |  | ||||||
|                     options={{ |  | ||||||
|                         headerShown: false, |  | ||||||
|                     }} |  | ||||||
|                 /> |  | ||||||
|                 <DrawerStack.Screen |  | ||||||
|                     name="settings" |  | ||||||
|                     component={SettingsScreen} |  | ||||||
|                     options={{ |  | ||||||
|                         title: i18n.t('screens.settings'), |  | ||||||
|                     }} |  | ||||||
|                 /> |  | ||||||
|                 <DrawerStack.Screen |  | ||||||
|                     name="about" |  | ||||||
|                     component={AboutScreen} |  | ||||||
|                     options={{ |  | ||||||
|                         title: i18n.t('screens.about'), |  | ||||||
|                     }} |  | ||||||
|                 /> |  | ||||||
|                 <DrawerStack.Screen |  | ||||||
|                     name="dependencies" |  | ||||||
|                     component={AboutDependenciesScreen} |  | ||||||
|                     options={{ |  | ||||||
|                         title: i18n.t('aboutScreen.libs') |  | ||||||
|                     }} |  | ||||||
|                 /> |  | ||||||
|                 <DrawerStack.Screen |  | ||||||
|                     name="debug" |  | ||||||
|                     component={DebugScreen} |  | ||||||
|                     options={{ |  | ||||||
|                         title: i18n.t('aboutScreen.debug') |  | ||||||
|                     }} |  | ||||||
|                 /> |  | ||||||
|                 {createScreenCollapsibleStack("self-menu", SelfMenuScreen, i18n.t('screens.menuSelf'))} |  | ||||||
|                 {getWebsiteStack("available-rooms", AvailableRoomScreen, i18n.t('screens.availableRooms'))} |  | ||||||
|                 {getWebsiteStack("bib", BibScreen, i18n.t('screens.bib'))} |  | ||||||
|                 {getWebsiteStack("amicale-website", AmicaleWebsiteScreen, "Amicale")} |  | ||||||
|                 {getWebsiteStack("elus-etudiants", ElusEtudiantsWebsiteScreen, "Élus Étudiants")} |  | ||||||
|                 {getWebsiteStack("wiketud", WiketudWebsiteScreen, "Wiketud")} |  | ||||||
|                 {getWebsiteStack("tutorinsa", TutorInsaWebsiteScreen, "Tutor'INSA")} |  | ||||||
|                 <DrawerStack.Screen |  | ||||||
|                     name="tetris" |  | ||||||
|                     component={TetrisScreen} |  | ||||||
|                     options={{ |  | ||||||
|                         title: i18n.t("game.title"), |  | ||||||
|                     }} |  | ||||||
|                 /> |  | ||||||
|                 <DrawerStack.Screen |  | ||||||
|                     name="login" |  | ||||||
|                     component={LoginScreen} |  | ||||||
|                     options={{ |  | ||||||
|                         title: i18n.t('screens.login'), |  | ||||||
|                     }} |  | ||||||
|                 /> |  | ||||||
|                 <DrawerStack.Screen |  | ||||||
|                     name="profile" |  | ||||||
|                     component={ProfileScreen} |  | ||||||
|                     options={{ |  | ||||||
|                             title: i18n.t('screens.profile'), |  | ||||||
|                         }} |  | ||||||
|                 /> |  | ||||||
|                 {createScreenCollapsibleStack("club-list", ClubListScreen, i18n.t('clubs.clubList'))} |  | ||||||
|                 <DrawerStack.Screen |  | ||||||
|                     name="club-information" |  | ||||||
|                     component={ClubDisplayScreen} |  | ||||||
|                     options={{ |  | ||||||
|                         title: i18n.t('screens.clubDisplayScreen'), |  | ||||||
|                         ...TransitionPresets.ModalSlideFromBottomIOS, |  | ||||||
|                     }} |  | ||||||
|                 /> |  | ||||||
|                 <DrawerStack.Screen |  | ||||||
|                     name="club-about" |  | ||||||
|                     component={ClubAboutScreen} |  | ||||||
|                     options={{ |  | ||||||
|                         title: i18n.t('screens.clubsAbout'), |  | ||||||
|                         ...TransitionPresets.ModalSlideFromBottomIOS, |  | ||||||
|                     }} |  | ||||||
|                 /> |  | ||||||
|                 <DrawerStack.Screen |  | ||||||
|                     name="vote" |  | ||||||
|                     component={VoteScreen} |  | ||||||
|                     options={{ |  | ||||||
|                         title: i18n.t('screens.vote'), |  | ||||||
|                     }} |  | ||||||
|                 /> |  | ||||||
|                 <DrawerStack.Screen |  | ||||||
|                     name="amicale-contact" |  | ||||||
|                     component={AmicaleContactScreen} |  | ||||||
|                     options={{ |  | ||||||
|                         title: i18n.t('screens.amicaleAbout'), |  | ||||||
|                     }} |  | ||||||
|                 /> |  | ||||||
|             </DrawerStack.Navigator> |  | ||||||
|         ); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const Drawer = createDrawerNavigator(); |  | ||||||
| 
 |  | ||||||
| type Props = { | type Props = { | ||||||
|     defaultHomeRoute: string | null, |     defaultHomeRoute: string | null, | ||||||
|     defaultHomeData: { [key: string]: any } |     defaultHomeData: { [key: string]: any } | ||||||
|  | @ -174,34 +70,16 @@ type Props = { | ||||||
| 
 | 
 | ||||||
| export default class DrawerNavigator extends React.Component<Props> { | export default class DrawerNavigator extends React.Component<Props> { | ||||||
| 
 | 
 | ||||||
|     createDrawerStackComponent: () => React.Node; |     createTabNavigator: () => React.Node; | ||||||
| 
 | 
 | ||||||
|     constructor(props: Props) { |     constructor(props: Props) { | ||||||
|         super(props); |         super(props); | ||||||
|         const createTabNavigator = () => <TabNavigator {...props}/> |         this.createTabNavigator = () => <TabNavigator {...props}/> | ||||||
|         this.createDrawerStackComponent = () => <DrawerStackComponent createTabNavigator={createTabNavigator}/>; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     getDrawerContent = (props: { |  | ||||||
|         navigation: DrawerNavigationProp, |  | ||||||
|         state: { [key: string]: any } |  | ||||||
|     }) => <Sidebar {...props}/> |  | ||||||
| 
 |  | ||||||
|     render() { |     render() { | ||||||
|         return ( |         return ( | ||||||
|             <Drawer.Navigator |             <MainStackComponent createTabNavigator={this.createTabNavigator}/> | ||||||
|                 initialRouteName={'stack'} |  | ||||||
|                 headerMode={'none'} |  | ||||||
|                 backBehavior={'initialRoute'} |  | ||||||
|                 drawerType={'front'} |  | ||||||
|                 drawerContent={this.getDrawerContent} |  | ||||||
|                 screenOptions={defaultScreenOptions} |  | ||||||
|             > |  | ||||||
|                 <Drawer.Screen |  | ||||||
|                     name="stack" |  | ||||||
|                     component={this.createDrawerStackComponent} |  | ||||||
|                 /> |  | ||||||
|             </Drawer.Navigator> |  | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -13,82 +13,97 @@ import ProximoAboutScreen from "../screens/Proximo/ProximoAboutScreen"; | ||||||
| import PlanexScreen from '../screens/Planex/PlanexScreen'; | import PlanexScreen from '../screens/Planex/PlanexScreen'; | ||||||
| import AsyncStorageManager from "../managers/AsyncStorageManager"; | import AsyncStorageManager from "../managers/AsyncStorageManager"; | ||||||
| import {useTheme} from 'react-native-paper'; | import {useTheme} from 'react-native-paper'; | ||||||
|  | import {Platform} from 'react-native'; | ||||||
| import i18n from "i18n-js"; | import i18n from "i18n-js"; | ||||||
| import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen"; | import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen"; | ||||||
| import ScannerScreen from "../screens/Home/ScannerScreen"; | import ScannerScreen from "../screens/Home/ScannerScreen"; | ||||||
| import MaterialHeaderButtons, {Item} from "../components/Overrides/CustomHeaderButton"; |  | ||||||
| import FeedItemScreen from "../screens/Home/FeedItemScreen"; | import FeedItemScreen from "../screens/Home/FeedItemScreen"; | ||||||
| import {createCollapsibleStack} from "react-navigation-collapsible"; | import {createCollapsibleStack} from "react-navigation-collapsible"; | ||||||
| import GroupSelectionScreen from "../screens/Planex/GroupSelectionScreen"; | import GroupSelectionScreen from "../screens/Planex/GroupSelectionScreen"; | ||||||
| import CustomTabBar from "../components/Tabbar/CustomTabBar"; | import CustomTabBar from "../components/Tabbar/CustomTabBar"; | ||||||
| import {DrawerNavigationProp} from "@react-navigation/drawer"; | import SelfMenuScreen from "../screens/Other/SelfMenuScreen"; | ||||||
|  | import AvailableRoomScreen from "../screens/Websites/AvailableRoomScreen"; | ||||||
|  | import BibScreen from "../screens/Websites/BibScreen"; | ||||||
|  | import {AmicaleWebsiteScreen} from "../screens/Websites/AmicaleWebsiteScreen"; | ||||||
|  | import {ElusEtudiantsWebsiteScreen} from "../screens/Websites/ElusEtudiantsWebsiteScreen"; | ||||||
|  | import {WiketudWebsiteScreen} from "../screens/Websites/WiketudWebsiteScreen"; | ||||||
|  | import {TutorInsaWebsiteScreen} from "../screens/Websites/TutorInsaWebsiteScreen"; | ||||||
|  | import TetrisScreen from "../screens/Tetris/TetrisScreen"; | ||||||
|  | import LoginScreen from "../screens/Amicale/LoginScreen"; | ||||||
|  | import ProfileScreen from "../screens/Amicale/ProfileScreen"; | ||||||
|  | import ClubListScreen from "../screens/Amicale/Clubs/ClubListScreen"; | ||||||
|  | import ClubAboutScreen from "../screens/Amicale/Clubs/ClubAboutScreen"; | ||||||
|  | import VoteScreen from "../screens/Amicale/VoteScreen"; | ||||||
|  | import AmicaleContactScreen from "../screens/Amicale/AmicaleContactScreen"; | ||||||
|  | import AmicaleHomeScreen from "../screens/Amicale/AmicaleHomeScreen"; | ||||||
|  | import WebsitesHomeScreen from "../screens/Websites/WebsitesHomeScreen"; | ||||||
|  | import InsaHomeScreen from "../screens/Insa/InsaHomeScreen"; | ||||||
| 
 | 
 | ||||||
| const defaultScreenOptions = { | const defaultScreenOptions = { | ||||||
|     gestureEnabled: true, |     gestureEnabled: true, | ||||||
|     cardOverlayEnabled: true, |     cardOverlayEnabled: true, | ||||||
|     ...TransitionPresets.SlideFromRightIOS, |     ...TransitionPresets.ScaleFromCenterAndroid, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| function getDrawerButton(navigation: DrawerNavigationProp) { | const modalTransition = Platform.OS === 'ios' ? TransitionPresets.ModalPresentationIOS : TransitionPresets.ModalSlideFromBottomIOS; | ||||||
|     return ( | 
 | ||||||
|         <MaterialHeaderButtons left={true}> | const screenTransition = Platform.OS === 'ios' ? TransitionPresets.SlideFromRightIOS : TransitionPresets.ScaleFromCenterAndroid; | ||||||
|             <Item title="menu" iconName="menu" onPress={navigation.openDrawer}/> | 
 | ||||||
|         </MaterialHeaderButtons> | function createScreenCollapsibleStack( | ||||||
|     ); |     name: string, | ||||||
|  |     component: any, | ||||||
|  |     title: string, | ||||||
|  |     useNativeDriver?: boolean, | ||||||
|  |     options?: { [key: string]: any }) { | ||||||
|  |     const {colors} = useTheme(); | ||||||
|  |     const screenOptions = options != null ? options : {}; | ||||||
|  |     return createCollapsibleStack( | ||||||
|  |         <HomeStack.Screen | ||||||
|  |             name={name} | ||||||
|  |             component={component} | ||||||
|  |             options={{ | ||||||
|  |                 title: title, | ||||||
|  |                 headerStyle: { | ||||||
|  |                     backgroundColor: colors.surface, | ||||||
|  |                 }, | ||||||
|  |                 ...screenOptions, | ||||||
|  |             }} | ||||||
|  |         />, | ||||||
|  |         { | ||||||
|  |             collapsedColor: 'transparent', | ||||||
|  |             useNativeDriver: useNativeDriver != null ? useNativeDriver : true, // native driver does not work with webview
 | ||||||
|  |         } | ||||||
|  |     ) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | function getWebsiteStack(name: string, component: any, title: string) { | ||||||
|  |     return createScreenCollapsibleStack(name, component, title, false); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| const ProximoStack = createStackNavigator(); | const ProximoStack = createStackNavigator(); | ||||||
| 
 | 
 | ||||||
| function ProximoStackComponent() { | function ProximoStackComponent() { | ||||||
|     const {colors} = useTheme(); |  | ||||||
|     return ( |     return ( | ||||||
|         <ProximoStack.Navigator |         <ProximoStack.Navigator | ||||||
|             initialRouteName="index" |             initialRouteName="index" | ||||||
|             headerMode="float" |             headerMode={"screen"} | ||||||
|             screenOptions={defaultScreenOptions} |             screenOptions={defaultScreenOptions} | ||||||
|         > |         > | ||||||
|             {createCollapsibleStack( |             {createScreenCollapsibleStack("index", ProximoMainScreen, "Proximo")} | ||||||
|                 <ProximoStack.Screen |             {createScreenCollapsibleStack( | ||||||
|                     name="index" |                 "proximo-list", | ||||||
|                     options={({navigation}) => { |                 ProximoListScreen, | ||||||
|                         const openDrawer = getDrawerButton.bind(this, navigation); |                 i18n.t('screens.proximoArticles'), | ||||||
|                         return { |                 true, | ||||||
|                             title: 'Proximo', |                 {...screenTransition}, | ||||||
|                             headerLeft: openDrawer, |  | ||||||
|                             headerStyle: { |  | ||||||
|                                 backgroundColor: colors.surface, |  | ||||||
|                             }, |  | ||||||
|                         }; |  | ||||||
|                     }} |  | ||||||
|                     component={ProximoMainScreen} |  | ||||||
|                 />, |  | ||||||
|                 { |  | ||||||
|                     collapsedColor: 'transparent', |  | ||||||
|                     useNativeDriver: true, |  | ||||||
|                 } |  | ||||||
|             )} |  | ||||||
|             {createCollapsibleStack( |  | ||||||
|                 <ProximoStack.Screen |  | ||||||
|                     name="proximo-list" |  | ||||||
|                     options={{ |  | ||||||
|                         title: i18n.t('screens.proximoArticles'), |  | ||||||
|                         headerStyle: { |  | ||||||
|                             backgroundColor: colors.surface, |  | ||||||
|                         } |  | ||||||
|                     }} |  | ||||||
|                     component={ProximoListScreen} |  | ||||||
|                 />, |  | ||||||
|                 { |  | ||||||
|                     collapsedColor: 'transparent', |  | ||||||
|                     useNativeDriver: true, |  | ||||||
|                 } |  | ||||||
|             )} |             )} | ||||||
|             <ProximoStack.Screen |             <ProximoStack.Screen | ||||||
|                 name="proximo-about" |                 name="proximo-about" | ||||||
|                 component={ProximoAboutScreen} |                 component={ProximoAboutScreen} | ||||||
|                 options={{ |                 options={{ | ||||||
|                     title: i18n.t('screens.proximo'), |                     title: i18n.t('screens.proximo'), | ||||||
|                     ...TransitionPresets.ModalSlideFromBottomIOS, |                     ...modalTransition, | ||||||
|                 }} |                 }} | ||||||
|             /> |             /> | ||||||
|         </ProximoStack.Navigator> |         </ProximoStack.Navigator> | ||||||
|  | @ -98,39 +113,19 @@ function ProximoStackComponent() { | ||||||
| const ProxiwashStack = createStackNavigator(); | const ProxiwashStack = createStackNavigator(); | ||||||
| 
 | 
 | ||||||
| function ProxiwashStackComponent() { | function ProxiwashStackComponent() { | ||||||
|     const {colors} = useTheme(); |  | ||||||
|     return ( |     return ( | ||||||
|         <ProxiwashStack.Navigator |         <ProxiwashStack.Navigator | ||||||
|             initialRouteName="index" |             initialRouteName="index" | ||||||
|             headerMode='float' |             headerMode={"screen"} | ||||||
|             screenOptions={defaultScreenOptions} |             screenOptions={defaultScreenOptions} | ||||||
|         > |         > | ||||||
|             {createCollapsibleStack( |             {createScreenCollapsibleStack("index", ProxiwashScreen, i18n.t('screens.proxiwash'))} | ||||||
|                 <ProxiwashStack.Screen |  | ||||||
|                     name="index" |  | ||||||
|                     component={ProxiwashScreen} |  | ||||||
|                     options={({navigation}) => { |  | ||||||
|                         const openDrawer = getDrawerButton.bind(this, navigation); |  | ||||||
|                         return { |  | ||||||
|                             title: i18n.t('screens.proxiwash'), |  | ||||||
|                             headerLeft: openDrawer, |  | ||||||
|                             headerStyle: { |  | ||||||
|                                 backgroundColor: colors.surface, |  | ||||||
|                             }, |  | ||||||
|                         }; |  | ||||||
|                     }} |  | ||||||
|                 />, |  | ||||||
|                 { |  | ||||||
|                     collapsedColor: 'transparent', |  | ||||||
|                     useNativeDriver: true, |  | ||||||
|                 } |  | ||||||
|             )} |  | ||||||
|             <ProxiwashStack.Screen |             <ProxiwashStack.Screen | ||||||
|                 name="proxiwash-about" |                 name="proxiwash-about" | ||||||
|                 component={ProxiwashAboutScreen} |                 component={ProxiwashAboutScreen} | ||||||
|                 options={{ |                 options={{ | ||||||
|                     title: i18n.t('screens.proxiwash'), |                     title: i18n.t('screens.proxiwash'), | ||||||
|                     ...TransitionPresets.ModalSlideFromBottomIOS, |                     ...modalTransition, | ||||||
|                 }} |                 }} | ||||||
|             /> |             /> | ||||||
|         </ProxiwashStack.Navigator> |         </ProxiwashStack.Navigator> | ||||||
|  | @ -143,18 +138,14 @@ function PlanningStackComponent() { | ||||||
|     return ( |     return ( | ||||||
|         <PlanningStack.Navigator |         <PlanningStack.Navigator | ||||||
|             initialRouteName="index" |             initialRouteName="index" | ||||||
|             headerMode='float' |             headerMode={"screen"} | ||||||
|             screenOptions={defaultScreenOptions} |             screenOptions={defaultScreenOptions} | ||||||
|         > |         > | ||||||
|             <PlanningStack.Screen |             <PlanningStack.Screen | ||||||
|                 name="index" |                 name="index" | ||||||
|                 component={PlanningScreen} |                 component={PlanningScreen} | ||||||
|                 options={({navigation}) => { |                 options={{ | ||||||
|                     const openDrawer = getDrawerButton.bind(this, navigation); |                     title: i18n.t('screens.planning'), | ||||||
|                     return { |  | ||||||
|                         title: i18n.t('screens.planning'), |  | ||||||
|                         headerLeft: openDrawer |  | ||||||
|                     }; |  | ||||||
|                 }} |                 }} | ||||||
|             /> |             /> | ||||||
|             <PlanningStack.Screen |             <PlanningStack.Screen | ||||||
|  | @ -162,7 +153,7 @@ function PlanningStackComponent() { | ||||||
|                 component={PlanningDisplayScreen} |                 component={PlanningDisplayScreen} | ||||||
|                 options={{ |                 options={{ | ||||||
|                     title: i18n.t('screens.planningDisplayScreen'), |                     title: i18n.t('screens.planningDisplayScreen'), | ||||||
|                     ...TransitionPresets.ModalSlideFromBottomIOS, |                     ...modalTransition, | ||||||
|                 }} |                 }} | ||||||
|             /> |             /> | ||||||
|         </PlanningStack.Navigator> |         </PlanningStack.Navigator> | ||||||
|  | @ -179,22 +170,18 @@ function HomeStackComponent(initialRoute: string | null, defaultData: { [key: st | ||||||
|     return ( |     return ( | ||||||
|         <HomeStack.Navigator |         <HomeStack.Navigator | ||||||
|             initialRouteName={"index"} |             initialRouteName={"index"} | ||||||
|             headerMode="float" |             headerMode={"screen"} | ||||||
|             screenOptions={defaultScreenOptions} |             screenOptions={defaultScreenOptions} | ||||||
|         > |         > | ||||||
|             {createCollapsibleStack( |             {createCollapsibleStack( | ||||||
|                 <HomeStack.Screen |                 <HomeStack.Screen | ||||||
|                     name="index" |                     name="index" | ||||||
|                     component={HomeScreen} |                     component={HomeScreen} | ||||||
|                     options={({navigation}) => { |                     options={{ | ||||||
|                         const openDrawer = getDrawerButton.bind(this, navigation); |                         title: i18n.t('screens.home'), | ||||||
|                         return { |                         headerStyle: { | ||||||
|                             title: i18n.t('screens.home'), |                             backgroundColor: colors.surface, | ||||||
|                             headerLeft: openDrawer, |                         }, | ||||||
|                             headerStyle: { |  | ||||||
|                                 backgroundColor: colors.surface, |  | ||||||
|                             }, |  | ||||||
|                         }; |  | ||||||
|                     }} |                     }} | ||||||
|                     initialParams={params} |                     initialParams={params} | ||||||
|                 />, |                 />, | ||||||
|  | @ -208,15 +195,7 @@ function HomeStackComponent(initialRoute: string | null, defaultData: { [key: st | ||||||
|                 component={PlanningDisplayScreen} |                 component={PlanningDisplayScreen} | ||||||
|                 options={{ |                 options={{ | ||||||
|                     title: i18n.t('screens.planningDisplayScreen'), |                     title: i18n.t('screens.planningDisplayScreen'), | ||||||
|                     ...TransitionPresets.ModalSlideFromBottomIOS, |                     ...modalTransition, | ||||||
|                 }} |  | ||||||
|             /> |  | ||||||
|             <HomeStack.Screen |  | ||||||
|                 name="home-club-information" |  | ||||||
|                 component={ClubDisplayScreen} |  | ||||||
|                 options={{ |  | ||||||
|                     title: i18n.t('screens.clubDisplayScreen'), |  | ||||||
|                     ...TransitionPresets.ModalSlideFromBottomIOS, |  | ||||||
|                 }} |                 }} | ||||||
|             /> |             /> | ||||||
|             <HomeStack.Screen |             <HomeStack.Screen | ||||||
|  | @ -224,7 +203,7 @@ function HomeStackComponent(initialRoute: string | null, defaultData: { [key: st | ||||||
|                 component={FeedItemScreen} |                 component={FeedItemScreen} | ||||||
|                 options={{ |                 options={{ | ||||||
|                     title: i18n.t('screens.feedDisplayScreen'), |                     title: i18n.t('screens.feedDisplayScreen'), | ||||||
|                     ...TransitionPresets.ModalSlideFromBottomIOS, |                     ...modalTransition, | ||||||
|                 }} |                 }} | ||||||
|             /> |             /> | ||||||
|             <HomeStack.Screen |             <HomeStack.Screen | ||||||
|  | @ -232,7 +211,89 @@ function HomeStackComponent(initialRoute: string | null, defaultData: { [key: st | ||||||
|                 component={ScannerScreen} |                 component={ScannerScreen} | ||||||
|                 options={{ |                 options={{ | ||||||
|                     title: i18n.t('screens.scanner'), |                     title: i18n.t('screens.scanner'), | ||||||
|                     ...TransitionPresets.ModalSlideFromBottomIOS, |                     ...modalTransition, | ||||||
|  |                 }} | ||||||
|  |             /> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |             {createScreenCollapsibleStack("self-menu", SelfMenuScreen, i18n.t('screens.menuSelf'))} | ||||||
|  |             {getWebsiteStack("available-rooms", AvailableRoomScreen, i18n.t('screens.availableRooms'))} | ||||||
|  |             {getWebsiteStack("bib", BibScreen, i18n.t('screens.bib'))} | ||||||
|  |             {getWebsiteStack("amicale-website", AmicaleWebsiteScreen, "Amicale")} | ||||||
|  |             {getWebsiteStack("elus-etudiants", ElusEtudiantsWebsiteScreen, "Élus Étudiants")} | ||||||
|  |             {getWebsiteStack("wiketud", WiketudWebsiteScreen, "Wiketud")} | ||||||
|  |             {getWebsiteStack("tutorinsa", TutorInsaWebsiteScreen, "Tutor'INSA")} | ||||||
|  |             <HomeStack.Screen | ||||||
|  |                 name="tetris" | ||||||
|  |                 component={TetrisScreen} | ||||||
|  |                 options={{ | ||||||
|  |                     title: i18n.t("game.title"), | ||||||
|  |                 }} | ||||||
|  |             /> | ||||||
|  |             <HomeStack.Screen | ||||||
|  |                 name="login" | ||||||
|  |                 component={LoginScreen} | ||||||
|  |                 options={{ | ||||||
|  |                     title: i18n.t('screens.login'), | ||||||
|  |                 }} | ||||||
|  |             /> | ||||||
|  |             <HomeStack.Screen | ||||||
|  |                 name="profile" | ||||||
|  |                 component={ProfileScreen} | ||||||
|  |                 options={{ | ||||||
|  |                     title: i18n.t('screens.profile'), | ||||||
|  |                 }} | ||||||
|  |             /> | ||||||
|  |             {createScreenCollapsibleStack("club-list", ClubListScreen, i18n.t('clubs.clubList'))} | ||||||
|  |             <HomeStack.Screen | ||||||
|  |                 name="club-information" | ||||||
|  |                 component={ClubDisplayScreen} | ||||||
|  |                 options={{ | ||||||
|  |                     title: i18n.t('screens.clubDisplayScreen'), | ||||||
|  |                     ...modalTransition, | ||||||
|  |                 }} | ||||||
|  |             /> | ||||||
|  |             <HomeStack.Screen | ||||||
|  |                 name="club-about" | ||||||
|  |                 component={ClubAboutScreen} | ||||||
|  |                 options={{ | ||||||
|  |                     title: i18n.t('screens.clubsAbout'), | ||||||
|  |                     ...modalTransition, | ||||||
|  |                 }} | ||||||
|  |             /> | ||||||
|  |             <HomeStack.Screen | ||||||
|  |                 name="vote" | ||||||
|  |                 component={VoteScreen} | ||||||
|  |                 options={{ | ||||||
|  |                     title: i18n.t('screens.vote'), | ||||||
|  |                 }} | ||||||
|  |             /> | ||||||
|  |             <HomeStack.Screen | ||||||
|  |                 name="amicale-contact" | ||||||
|  |                 component={AmicaleContactScreen} | ||||||
|  |                 options={{ | ||||||
|  |                     title: i18n.t('screens.amicaleAbout'), | ||||||
|  |                 }} | ||||||
|  |             /> | ||||||
|  |             <HomeStack.Screen | ||||||
|  |                 name="amicale-home" | ||||||
|  |                 component={AmicaleHomeScreen} | ||||||
|  |                 options={{ | ||||||
|  |                     title: "AMICALE HOME", | ||||||
|  |                 }} | ||||||
|  |             /> | ||||||
|  |             <HomeStack.Screen | ||||||
|  |                 name="websites-home" | ||||||
|  |                 component={WebsitesHomeScreen} | ||||||
|  |                 options={{ | ||||||
|  |                     title: "WEBSITES HOME", | ||||||
|  |                 }} | ||||||
|  |             /> | ||||||
|  |             <HomeStack.Screen | ||||||
|  |                 name="insa-home" | ||||||
|  |                 component={InsaHomeScreen} | ||||||
|  |                 options={{ | ||||||
|  |                     title: "INSA HOME", | ||||||
|                 }} |                 }} | ||||||
|             /> |             /> | ||||||
|         </HomeStack.Navigator> |         </HomeStack.Navigator> | ||||||
|  | @ -242,50 +303,19 @@ function HomeStackComponent(initialRoute: string | null, defaultData: { [key: st | ||||||
| const PlanexStack = createStackNavigator(); | const PlanexStack = createStackNavigator(); | ||||||
| 
 | 
 | ||||||
| function PlanexStackComponent() { | function PlanexStackComponent() { | ||||||
|     const {colors} = useTheme(); |  | ||||||
|     return ( |     return ( | ||||||
|         <PlanexStack.Navigator |         <PlanexStack.Navigator | ||||||
|             initialRouteName="index" |             initialRouteName="index" | ||||||
|             headerMode="float" |             headerMode={"screen"} | ||||||
|             screenOptions={defaultScreenOptions} |             screenOptions={defaultScreenOptions} | ||||||
|         > |         > | ||||||
|             {createCollapsibleStack( |             {getWebsiteStack("index", PlanexScreen, "Planex")} | ||||||
|                 <PlanexStack.Screen |             {createScreenCollapsibleStack( | ||||||
|                     name="index" |                 "group-select", | ||||||
|                     component={PlanexScreen} |                 GroupSelectionScreen, | ||||||
|                     options={({navigation}) => { |                 "GROUP SELECT", | ||||||
|                         const openDrawer = getDrawerButton.bind(this, navigation); |                 true, | ||||||
|                         return { |                 {...modalTransition})} | ||||||
|                             title: 'Planex', |  | ||||||
|                             headerLeft: openDrawer, |  | ||||||
|                             headerStyle: { |  | ||||||
|                                 backgroundColor: colors.surface, |  | ||||||
|                             }, |  | ||||||
|                         }; |  | ||||||
|                     }} |  | ||||||
|                 />, |  | ||||||
|                 { |  | ||||||
|                     collapsedColor: 'transparent', |  | ||||||
|                     useNativeDriver: false, // native driver does not work with webview
 |  | ||||||
|                 } |  | ||||||
|             )} |  | ||||||
|             {createCollapsibleStack( |  | ||||||
|                 <PlanexStack.Screen |  | ||||||
|                     name="group-select" |  | ||||||
|                     component={GroupSelectionScreen} |  | ||||||
|                     options={{ |  | ||||||
|                         title: 'GroupSelectionScreen', |  | ||||||
|                         headerStyle: { |  | ||||||
|                             backgroundColor: colors.surface, |  | ||||||
|                         }, |  | ||||||
|                         ...TransitionPresets.ModalSlideFromBottomIOS, |  | ||||||
|                     }} |  | ||||||
|                 />, |  | ||||||
|                 { |  | ||||||
|                     collapsedColor: 'transparent', |  | ||||||
|                     useNativeDriver: true, |  | ||||||
|                 } |  | ||||||
|             )} |  | ||||||
|         </PlanexStack.Navigator> |         </PlanexStack.Navigator> | ||||||
|     ); |     ); | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										85
									
								
								src/screens/Amicale/AmicaleHomeScreen.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								src/screens/Amicale/AmicaleHomeScreen.js
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,85 @@ | ||||||
|  | // @flow
 | ||||||
|  | 
 | ||||||
|  | import * as React from 'react'; | ||||||
|  | import {ScrollView, StyleSheet} from "react-native"; | ||||||
|  | import {Button, withTheme} from 'react-native-paper'; | ||||||
|  | 
 | ||||||
|  | type Props = { | ||||||
|  |     navigation: Object, | ||||||
|  |     route: Object, | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | type State = {} | ||||||
|  | 
 | ||||||
|  | class AmicaleHomeScreen extends React.Component<Props, State> { | ||||||
|  | 
 | ||||||
|  |     state = {}; | ||||||
|  | 
 | ||||||
|  |     colors: Object; | ||||||
|  | 
 | ||||||
|  |     constructor(props) { | ||||||
|  |         super(props); | ||||||
|  | 
 | ||||||
|  |         this.colors = props.theme.colors; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     render() { | ||||||
|  |         const nav = this.props.navigation; | ||||||
|  |         return ( | ||||||
|  |             <ScrollView> | ||||||
|  |                 <Button | ||||||
|  |                     icon={"login"} | ||||||
|  |                     onPress={() => nav.navigate("login")} | ||||||
|  |                 > | ||||||
|  |                     LOGIN | ||||||
|  |                 </Button> | ||||||
|  |                 <Button | ||||||
|  |                     icon={"information"} | ||||||
|  |                     onPress={() => nav.navigate("amicale-contact")} | ||||||
|  |                 > | ||||||
|  |                     INFO | ||||||
|  |                 </Button> | ||||||
|  |                 <Button | ||||||
|  |                     icon={"information"} | ||||||
|  |                     onPress={() => nav.navigate("club-list")} | ||||||
|  |                 > | ||||||
|  |                     CLUBS | ||||||
|  |                 </Button> | ||||||
|  |                 <Button | ||||||
|  |                     icon={"information"} | ||||||
|  |                     onPress={() => nav.navigate("profile")} | ||||||
|  |                 > | ||||||
|  |                     PROFILE | ||||||
|  |                 </Button> | ||||||
|  |                 <Button | ||||||
|  |                     icon={"information"} | ||||||
|  |                     onPress={() => nav.navigate("vote")} | ||||||
|  |                 > | ||||||
|  |                     VOTE | ||||||
|  |                 </Button> | ||||||
|  |             </ScrollView> | ||||||
|  |         ); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const styles = StyleSheet.create({ | ||||||
|  |     container: { | ||||||
|  |         flex: 1, | ||||||
|  |         flexDirection: 'column', | ||||||
|  |         justifyContent: 'center', | ||||||
|  |     }, | ||||||
|  |     card: { | ||||||
|  |         margin: 10, | ||||||
|  |     }, | ||||||
|  |     header: { | ||||||
|  |         fontSize: 36, | ||||||
|  |         marginBottom: 48 | ||||||
|  |     }, | ||||||
|  |     textInput: {}, | ||||||
|  |     btnContainer: { | ||||||
|  |         marginTop: 5, | ||||||
|  |         marginBottom: 10, | ||||||
|  |     } | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | export default withTheme(AmicaleHomeScreen); | ||||||
|  | @ -11,7 +11,6 @@ import SquareDashboardItem from "../../components/Home/SmallDashboardItem"; | ||||||
| import PreviewEventDashboardItem from "../../components/Home/PreviewEventDashboardItem"; | import PreviewEventDashboardItem from "../../components/Home/PreviewEventDashboardItem"; | ||||||
| import {stringToDate} from "../../utils/Planning"; | import {stringToDate} from "../../utils/Planning"; | ||||||
| import ActionsDashBoardItem from "../../components/Home/ActionsDashboardItem"; | import ActionsDashBoardItem from "../../components/Home/ActionsDashboardItem"; | ||||||
| import ConnectionManager from "../../managers/ConnectionManager"; |  | ||||||
| import {CommonActions} from '@react-navigation/native'; | import {CommonActions} from '@react-navigation/native'; | ||||||
| import MaterialHeaderButtons, {Item} from "../../components/Overrides/CustomHeaderButton"; | import MaterialHeaderButtons, {Item} from "../../components/Overrides/CustomHeaderButton"; | ||||||
| import AnimatedFAB from "../../components/Animations/AnimatedFAB"; | import AnimatedFAB from "../../components/Animations/AnimatedFAB"; | ||||||
|  | @ -103,14 +102,11 @@ class HomeScreen extends React.Component<Props> { | ||||||
| 
 | 
 | ||||||
|     colors: Object; |     colors: Object; | ||||||
| 
 | 
 | ||||||
|     isLoggedIn: boolean | null; |  | ||||||
| 
 |  | ||||||
|     fabRef: { current: null | AnimatedFAB }; |     fabRef: { current: null | AnimatedFAB }; | ||||||
| 
 | 
 | ||||||
|     constructor(props) { |     constructor(props) { | ||||||
|         super(props); |         super(props); | ||||||
|         this.colors = props.theme.colors; |         this.colors = props.theme.colors; | ||||||
|         this.isLoggedIn = null; |  | ||||||
|         this.fabRef = React.createRef(); |         this.fabRef = React.createRef(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -132,12 +128,9 @@ class HomeScreen extends React.Component<Props> { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     onScreenFocus = () => { |     onScreenFocus = () => { | ||||||
|         if (this.isLoggedIn !== ConnectionManager.getInstance().isLoggedIn()) { |         this.props.navigation.setOptions({ | ||||||
|             this.isLoggedIn = ConnectionManager.getInstance().isLoggedIn(); |             headerRight: this.getHeaderButton, | ||||||
|             this.props.navigation.setOptions({ |         }); | ||||||
|                 headerRight: this.getHeaderButton, |  | ||||||
|             }); |  | ||||||
|         } |  | ||||||
|         // handle link open when home is not focused or created
 |         // handle link open when home is not focused or created
 | ||||||
|         this.handleNavigationParams(); |         this.handleNavigationParams(); | ||||||
|     }; |     }; | ||||||
|  | @ -153,15 +146,11 @@ class HomeScreen extends React.Component<Props> { | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     getHeaderButton = () => { |     getHeaderButton = () => { | ||||||
|         const screen = this.isLoggedIn |         const onPressSettings = () => this.props.navigation.navigate("settings"); | ||||||
|             ? "profile" |         const onPressAbout = () => this.props.navigation.navigate("about"); | ||||||
|             : "login"; |  | ||||||
|         const icon = this.isLoggedIn |  | ||||||
|             ? "account" |  | ||||||
|             : "login"; |  | ||||||
|         const onPress = () => this.props.navigation.navigate(screen); |  | ||||||
|         return <MaterialHeaderButtons> |         return <MaterialHeaderButtons> | ||||||
|             <Item title="main" iconName={icon} onPress={onPress}/> |             <Item title="settings" iconName={"settings"} onPress={onPressSettings}/> | ||||||
|  |             <Item title="information" iconName={"information"} onPress={onPressAbout}/> | ||||||
|         </MaterialHeaderButtons>; |         </MaterialHeaderButtons>; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										85
									
								
								src/screens/Insa/InsaHomeScreen.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								src/screens/Insa/InsaHomeScreen.js
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,85 @@ | ||||||
|  | // @flow
 | ||||||
|  | 
 | ||||||
|  | import * as React from 'react'; | ||||||
|  | import {ScrollView, StyleSheet} from "react-native"; | ||||||
|  | import {Button, withTheme} from 'react-native-paper'; | ||||||
|  | 
 | ||||||
|  | type Props = { | ||||||
|  |     navigation: Object, | ||||||
|  |     route: Object, | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | type State = {} | ||||||
|  | 
 | ||||||
|  | class InsaHomeScreen extends React.Component<Props, State> { | ||||||
|  | 
 | ||||||
|  |     state = {}; | ||||||
|  | 
 | ||||||
|  |     colors: Object; | ||||||
|  | 
 | ||||||
|  |     constructor(props) { | ||||||
|  |         super(props); | ||||||
|  | 
 | ||||||
|  |         this.colors = props.theme.colors; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     render() { | ||||||
|  |         const nav = this.props.navigation; | ||||||
|  |         return ( | ||||||
|  |             <ScrollView> | ||||||
|  |                 <Button | ||||||
|  |                     icon={"information"} | ||||||
|  |                     onPress={() => nav.navigate("self-menu")} | ||||||
|  |                 > | ||||||
|  |                     RU | ||||||
|  |                 </Button> | ||||||
|  |                 <Button | ||||||
|  |                     icon={"information"} | ||||||
|  |                     onPress={() => nav.navigate("available-rooms")} | ||||||
|  |                 > | ||||||
|  |                     AVAILABLE ROOMS | ||||||
|  |                 </Button> | ||||||
|  |                 <Button | ||||||
|  |                     icon={"information"} | ||||||
|  |                     onPress={() => nav.navigate("bib")} | ||||||
|  |                 > | ||||||
|  |                     BIB | ||||||
|  |                 </Button> | ||||||
|  |                 <Button// TODO create webview
 | ||||||
|  |                     icon={"information"} | ||||||
|  |                     onPress={() => nav.navigate("self-menu")} | ||||||
|  |                 > | ||||||
|  |                     EMAIL | ||||||
|  |                 </Button> | ||||||
|  |                 <Button// TODO create webview
 | ||||||
|  |                     icon={"information"} | ||||||
|  |                     onPress={() => nav.navigate("self-menu")} | ||||||
|  |                 > | ||||||
|  |                     ENT | ||||||
|  |                 </Button> | ||||||
|  |             </ScrollView> | ||||||
|  |         ); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const styles = StyleSheet.create({ | ||||||
|  |     container: { | ||||||
|  |         flex: 1, | ||||||
|  |         flexDirection: 'column', | ||||||
|  |         justifyContent: 'center', | ||||||
|  |     }, | ||||||
|  |     card: { | ||||||
|  |         margin: 10, | ||||||
|  |     }, | ||||||
|  |     header: { | ||||||
|  |         fontSize: 36, | ||||||
|  |         marginBottom: 48 | ||||||
|  |     }, | ||||||
|  |     textInput: {}, | ||||||
|  |     btnContainer: { | ||||||
|  |         marginTop: 5, | ||||||
|  |         marginBottom: 10, | ||||||
|  |     } | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | export default withTheme(InsaHomeScreen); | ||||||
							
								
								
									
										79
									
								
								src/screens/Websites/WebsitesHomeScreen.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								src/screens/Websites/WebsitesHomeScreen.js
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,79 @@ | ||||||
|  | // @flow
 | ||||||
|  | 
 | ||||||
|  | import * as React from 'react'; | ||||||
|  | import {ScrollView, StyleSheet} from "react-native"; | ||||||
|  | import {Button, withTheme} from 'react-native-paper'; | ||||||
|  | 
 | ||||||
|  | type Props = { | ||||||
|  |     navigation: Object, | ||||||
|  |     route: Object, | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | type State = {} | ||||||
|  | 
 | ||||||
|  | class WebsitesHomeScreen extends React.Component<Props, State> { | ||||||
|  | 
 | ||||||
|  |     state = {}; | ||||||
|  | 
 | ||||||
|  |     colors: Object; | ||||||
|  | 
 | ||||||
|  |     constructor(props) { | ||||||
|  |         super(props); | ||||||
|  | 
 | ||||||
|  |         this.colors = props.theme.colors; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     render() { | ||||||
|  |         const nav = this.props.navigation; | ||||||
|  |         return ( | ||||||
|  |             <ScrollView> | ||||||
|  |                 <Button | ||||||
|  |                     icon={"information"} | ||||||
|  |                     onPress={() => nav.navigate("amicale-website")} | ||||||
|  |                 > | ||||||
|  |                     AMICALE | ||||||
|  |                 </Button> | ||||||
|  |                 <Button | ||||||
|  |                     icon={"information"} | ||||||
|  |                     onPress={() => nav.navigate("elus-etudiants")} | ||||||
|  |                 > | ||||||
|  |                     ELUS ETUDIANTS | ||||||
|  |                 </Button> | ||||||
|  |                 <Button | ||||||
|  |                     icon={"information"} | ||||||
|  |                     onPress={() => nav.navigate("tutorinsa")} | ||||||
|  |                 > | ||||||
|  |                     TUTOR INSA | ||||||
|  |                 </Button> | ||||||
|  |                 <Button | ||||||
|  |                     icon={"information"} | ||||||
|  |                     onPress={() => nav.navigate("wiketud")} | ||||||
|  |                 > | ||||||
|  |                     WIKETUD | ||||||
|  |                 </Button> | ||||||
|  |             </ScrollView> | ||||||
|  |         ); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const styles = StyleSheet.create({ | ||||||
|  |     container: { | ||||||
|  |         flex: 1, | ||||||
|  |         flexDirection: 'column', | ||||||
|  |         justifyContent: 'center', | ||||||
|  |     }, | ||||||
|  |     card: { | ||||||
|  |         margin: 10, | ||||||
|  |     }, | ||||||
|  |     header: { | ||||||
|  |         fontSize: 36, | ||||||
|  |         marginBottom: 48 | ||||||
|  |     }, | ||||||
|  |     textInput: {}, | ||||||
|  |     btnContainer: { | ||||||
|  |         marginTop: 5, | ||||||
|  |         marginBottom: 10, | ||||||
|  |     } | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | export default withTheme(WebsitesHomeScreen); | ||||||
|  | @ -7,7 +7,7 @@ export default class URLHandler { | ||||||
|     static CLUB_INFO_URL_PATH = "club"; |     static CLUB_INFO_URL_PATH = "club"; | ||||||
|     static EVENT_INFO_URL_PATH = "event"; |     static EVENT_INFO_URL_PATH = "event"; | ||||||
| 
 | 
 | ||||||
|     static CLUB_INFO_ROUTE = "home-club-information"; |     static CLUB_INFO_ROUTE = "club-information"; | ||||||
|     static EVENT_INFO_ROUTE = "home-planning-information"; |     static EVENT_INFO_ROUTE = "home-planning-information"; | ||||||
| 
 | 
 | ||||||
|     onInitialURLParsed: Function; |     onInitialURLParsed: Function; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue