From 77cc5d87465a307b41d29da3d9a6a29244249b11 Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Tue, 21 Apr 2020 12:59:36 +0200 Subject: [PATCH] Changed tab order and stacks --- src/components/Home/ActionsDashboardItem.js | 16 --- src/components/Tabbar/CustomTabBar.js | 4 +- src/navigation/MainTabNavigator.js | 139 ++++++++++---------- src/screens/Home/HomeScreen.js | 15 ++- src/screens/Websites/WebsitesHomeScreen.js | 12 ++ 5 files changed, 93 insertions(+), 93 deletions(-) diff --git a/src/components/Home/ActionsDashboardItem.js b/src/components/Home/ActionsDashboardItem.js index 6494968..95d9f8c 100644 --- a/src/components/Home/ActionsDashboardItem.js +++ b/src/components/Home/ActionsDashboardItem.js @@ -37,22 +37,6 @@ class ActionsDashBoardItem extends React.Component { onPress={() => this.props.navigation.navigate("amicale-home")} style={styles.list} /> - } - right={props => } - onPress={() => this.props.navigation.navigate("websites-home")} - style={styles.list} - /> - } - right={props => } - onPress={() => this.props.navigation.navigate("insa-home")} - style={styles.list} - /> ); } diff --git a/src/components/Tabbar/CustomTabBar.js b/src/components/Tabbar/CustomTabBar.js index b49dba1..f55bfd7 100644 --- a/src/components/Tabbar/CustomTabBar.js +++ b/src/components/Tabbar/CustomTabBar.js @@ -18,9 +18,9 @@ type State = { } const TAB_ICONS = { - planning: 'calendar-range', proxiwash: 'tshirt-crew', - proximo: 'cart', + students: 'account-circle', + insa: 'book', planex: 'clock', }; diff --git a/src/navigation/MainTabNavigator.js b/src/navigation/MainTabNavigator.js index 02eb1e5..aecebcc 100644 --- a/src/navigation/MainTabNavigator.js +++ b/src/navigation/MainTabNavigator.js @@ -51,6 +51,7 @@ const screenTransition = Platform.OS === 'ios' ? TransitionPresets.SlideFromRigh function createScreenCollapsibleStack( name: string, + Stack: any, component: any, title: string, useNativeDriver?: boolean, @@ -58,7 +59,7 @@ function createScreenCollapsibleStack( const {colors} = useTheme(); const screenOptions = options != null ? options : {}; return createCollapsibleStack( - - {createScreenCollapsibleStack("index", ProximoMainScreen, "Proximo")} + + {getWebsiteStack("amicale-website", StudentsStack, AmicaleWebsiteScreen, "Amicale")} + {getWebsiteStack("elus-etudiants", StudentsStack, ElusEtudiantsWebsiteScreen, "Élus Étudiants")} + {getWebsiteStack("wiketud", StudentsStack, WiketudWebsiteScreen, "Wiketud")} + {getWebsiteStack("tutorinsa", StudentsStack, TutorInsaWebsiteScreen, "Tutor'INSA")} + {createScreenCollapsibleStack("proximo", StudentsStack, ProximoMainScreen, "Proximo")} {createScreenCollapsibleStack( "proximo-list", + StudentsStack, ProximoListScreen, i18n.t('screens.proximoArticles'), true, {...screenTransition}, )} - - + + + ); } @@ -119,7 +147,7 @@ function ProxiwashStackComponent() { headerMode={"screen"} screenOptions={defaultScreenOptions} > - {createScreenCollapsibleStack("index", ProxiwashScreen, i18n.t('screens.proxiwash'))} + {createScreenCollapsibleStack("index", ProxiwashStack, ProxiwashScreen, i18n.t('screens.proxiwash'))} - - - + {getWebsiteStack("available-rooms", InsaStack, AvailableRoomScreen, i18n.t('screens.availableRooms'))} + {getWebsiteStack("bib", InsaStack, BibScreen, i18n.t('screens.bib'))} + {createScreenCollapsibleStack("self-menu", InsaStack, SelfMenuScreen, i18n.t('screens.menuSelf'))} + ); } @@ -190,14 +213,6 @@ function HomeStackComponent(initialRoute: string | null, defaultData: { [key: st useNativeDriver: true, } )} - - - - {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")} + - {createScreenCollapsibleStack("club-list", ClubListScreen, i18n.t('clubs.clubList'))} + {createScreenCollapsibleStack("club-list", HomeStack, ClubListScreen, i18n.t('clubs.clubList'))} - - ); } @@ -309,9 +309,10 @@ function PlanexStackComponent() { headerMode={"screen"} screenOptions={defaultScreenOptions} > - {getWebsiteStack("index", PlanexScreen, "Planex")} + {getWebsiteStack("index", PlanexStack, PlanexScreen, "Planex")} {createScreenCollapsibleStack( "group-select", + PlanexStack, GroupSelectionScreen, "GROUP SELECT", true, @@ -348,26 +349,28 @@ export default class TabNavigator extends React.Component { tabBar={props => } > + + { colors: Object; fabRef: { current: null | AnimatedFAB }; + currentNewFeed: Array; constructor(props) { super(props); this.colors = props.theme.colors; this.fabRef = React.createRef(); + this.currentNewFeed = []; } /** @@ -174,12 +176,10 @@ class HomeScreen extends React.Component { */ createDataset = (fetchedData: rawDashboard) => { // fetchedData = DATA; - let newsData = []; - let dashboardData = []; - if (fetchedData.news_feed != null) - newsData = fetchedData.news_feed.data; - else - newsData = []; + let dashboardData; + if (fetchedData.news_feed != null) { + this.currentNewFeed = fetchedData.news_feed.data; + } if (fetchedData.dashboard != null) dashboardData = this.generateDashboardDataset(fetchedData.dashboard); else @@ -192,7 +192,7 @@ class HomeScreen extends React.Component { }, { title: i18n.t('homeScreen.newsFeed'), - data: newsData, + data: this.currentNewFeed, id: SECTIONS_ID[1] } ]; @@ -256,6 +256,7 @@ class HomeScreen extends React.Component { id: 'event', content: dashboardData == null ? [] : dashboardData.today_events }, + ]; } diff --git a/src/screens/Websites/WebsitesHomeScreen.js b/src/screens/Websites/WebsitesHomeScreen.js index afac6be..9dbaeab 100644 --- a/src/screens/Websites/WebsitesHomeScreen.js +++ b/src/screens/Websites/WebsitesHomeScreen.js @@ -51,6 +51,18 @@ class WebsitesHomeScreen extends React.Component { > WIKETUD + + ); }