diff --git a/App.js b/App.js index 2b7152a..b3b9ffd 100644 --- a/App.js +++ b/App.js @@ -5,7 +5,7 @@ import {Platform, StatusBar} from 'react-native'; import LocaleManager from './src/managers/LocaleManager'; import AsyncStorageManager from "./src/managers/AsyncStorageManager"; import CustomIntroSlider from "./src/components/Custom/CustomIntroSlider"; -import {SplashScreen} from 'expo'; +import {Linking, SplashScreen} from 'expo'; import ThemeManager from './src/managers/ThemeManager'; import {NavigationContainer} from '@react-navigation/native'; import {createStackNavigator} from '@react-navigation/stack'; @@ -41,12 +41,73 @@ export default class App extends React.Component { onIntroDone: Function; onUpdateTheme: Function; + navigatorRef: Object; + + defaultRoute: Array; + defaultData: Object; + + createDrawerNavigator: Function; + constructor() { super(); LocaleManager.initTranslations(); this.onIntroDone = this.onIntroDone.bind(this); this.onUpdateTheme = this.onUpdateTheme.bind(this); SplashScreen.preventAutoHide(); + this.navigatorRef = React.createRef(); + this.defaultRoute = []; + this.defaultData = {}; + // this.defaultRoute = ["main", "home", "club-information"]; + // this.defaultData = {clubId: 0}; + this.handleUrls(); + } + + handleUrls() { + console.log(Linking.makeUrl('main/home/club-information', {clubId: 1})); + Linking.addEventListener('url', this.onUrl); + Linking.parseInitialURLAsync().then(this.onParsedUrl); + } + + onUrl = (url: string) => { + this.onParsedUrl(Linking.parse(url)); + }; + + onParsedUrl = ({path, queryParams}: Object) => { + if (path !== null) { + let pathArray = path.split('/'); + if (this.isClubInformationLink(pathArray)) + this.handleClubInformationUrl(queryParams); + else if (this.isPlanningInformationLink(pathArray)) + this.handlePlanningInformationUrl(queryParams); + } + }; + + isClubInformationLink(pathArray: Array) { + return pathArray[0] === "main" && pathArray[1] === "home" && pathArray[2] === "club-information"; + } + + isPlanningInformationLink(pathArray: Array) { + return pathArray[0] === "main" && pathArray[1] === "home" && pathArray[2] === "planning-information"; + } + + handleClubInformationUrl(params: Object) { + if (params !== undefined && params.clubId !== undefined) { + let id = parseInt(params.clubId); + if (!isNaN(id)) { + this.defaultRoute = ["main", "home", "club-information"]; + this.defaultData = {clubId: id}; + } + } + } + + handlePlanningInformationUrl(params: Object) { + if (params !== undefined && params.eventId !== undefined) { + let id = parseInt(params.eventId); + if (!isNaN(id)) { + this.defaultRoute = ["main", "home", "planning-information"]; + this.defaultData = {eventId: id}; + } + } } /** @@ -92,8 +153,10 @@ export default class App extends React.Component { await initExpoToken(); try { await ConnectionManager.getInstance().recoverLogin(); - } catch (e) {} + } catch (e) { + } + this.createDrawerNavigator = () => ; this.onLoadFinished(); } @@ -130,9 +193,9 @@ export default class App extends React.Component { } else { return ( - + - + diff --git a/app.json b/app.json index eb3fb76..a488769 100644 --- a/app.json +++ b/app.json @@ -3,6 +3,7 @@ "name": "Campus", "description": "Application mobile compatible Android et iOS pour l'Amicale INSA Toulouse. Grâce à cette application, vous avez facilement accès aux news du campus, aux emplois du temps, à l'état de la laverie, et bien d'autres services ! Ceci est une version Beta, Toutes les fonctionnalités ne sont pas encore implémentées, et il est possible de rencontrer quelques bugs.", "slug": "application-amicale", + "scheme": "campus-insat", "privacy": "public", "platforms": [ "ios", diff --git a/src/components/Amicale/AuthenticatedScreen.js b/src/components/Amicale/AuthenticatedScreen.js index 908b201..c081524 100644 --- a/src/components/Amicale/AuthenticatedScreen.js +++ b/src/components/Amicale/AuthenticatedScreen.js @@ -73,7 +73,7 @@ class AuthenticatedScreen extends React.Component { if (this.errorCode === ERROR_TYPE.BAD_TOKEN) { // Token expired, logout user this.connectionManager.disconnect() .then(() => { - this.props.navigation.navigate("LoginScreen"); + this.props.navigation.navigate("login"); }); } else if (this.allRequestsFinished()) this.setState({loading: false}); diff --git a/src/components/Amicale/LogoutDialog.js b/src/components/Amicale/LogoutDialog.js index 297ec90..9d70d40 100644 --- a/src/components/Amicale/LogoutDialog.js +++ b/src/components/Amicale/LogoutDialog.js @@ -19,7 +19,7 @@ class LogoutDialog extends React.PureComponent { .then(() => { this.props.navigation.reset({ index: 0, - routes: [{name: 'Main'}], + routes: [{name: 'main'}], }); this.props.onDismiss(); resolve(); diff --git a/src/components/Home/ActionsDashboardItem.js b/src/components/Home/ActionsDashboardItem.js index 65ab674..829ccbb 100644 --- a/src/components/Home/ActionsDashboardItem.js +++ b/src/components/Home/ActionsDashboardItem.js @@ -21,7 +21,7 @@ class ActionsDashBoardItem extends React.PureComponent { openDrawer = () => this.props.navigation.openDrawer(); - gotToSettings = () => this.props.navigation.navigate("SettingsScreen"); + gotToSettings = () => this.props.navigation.navigate("settings"); render() { return ( diff --git a/src/components/Sidebar/Sidebar.js b/src/components/Sidebar/Sidebar.js index 906bd49..1f306bc 100644 --- a/src/components/Sidebar/Sidebar.js +++ b/src/components/Sidebar/Sidebar.js @@ -40,33 +40,33 @@ class SideBar extends React.Component { const mainData = [ { name: i18n.t('screens.home'), - route: "Main", + route: "main", icon: "home", }, ]; const amicaleData = [ { name: i18n.t('screens.login'), - route: "LoginScreen", + route: "login", icon: "login", onlyWhenLoggedOut: true, shouldEmphasis: true, }, { name: i18n.t('screens.profile'), - route: "ProfileScreen", + route: "profile", icon: "account", onlyWhenLoggedIn: true, }, { name: i18n.t('clubs.clubList'), - route: "ClubListScreen", + route: "club-list", icon: "account-group", onlyWhenLoggedIn: true, }, { name: i18n.t('screens.vote'), - route: "VoteScreen", + route: "vote", icon: "vote", onlyWhenLoggedIn: true, }, @@ -81,28 +81,28 @@ class SideBar extends React.Component { const servicesData = [ { name: i18n.t('screens.menuSelf'), - route: "SelfMenuScreen", + route: "self-menu", icon: "silverware-fork-knife", }, { name: i18n.t('screens.availableRooms'), - route: "AvailableRoomScreen", + route: "available-rooms", icon: "calendar-check", }, { name: i18n.t('screens.bib'), - route: "BibScreen", + route: "bib", icon: "book", }, { name: i18n.t('screens.bluemind'), - route: "BlueMindScreen", + route: "bluemind", link: "https://etud-mel.insa-toulouse.fr/webmail/", icon: "email", }, { name: i18n.t('screens.ent'), - route: "EntScreen", + route: "ent", link: "https://ent.insa-toulouse.fr/", icon: "notebook", }, @@ -110,25 +110,25 @@ class SideBar extends React.Component { const websitesData = [ { name: "Amicale", - route: "AmicaleScreen", + route: "amicale", link: "https://amicale-insat.fr/", icon: "alpha-a-box", }, { name: "Élus Étudiants", - route: "ElusEtudScreen", + route: "elus-etudiants", link: "https://etud.insa-toulouse.fr/~eeinsat/", icon: "alpha-e-box", }, { name: "Wiketud", - route: "WiketudScreen", + route: "wiketud", link: "https://wiki.etud.insa-toulouse.fr", icon: "wikipedia", }, { name: "Tutor'INSA", - route: "TutorInsaScreen", + route: "tutor-insa", link: "https://www.etud.insa-toulouse.fr/~tutorinsa/", icon: "school", }, @@ -136,12 +136,12 @@ class SideBar extends React.Component { const othersData = [ { name: i18n.t('screens.settings'), - route: "SettingsScreen", + route: "settings", icon: "settings", }, { name: i18n.t('screens.about'), - route: "AboutScreen", + route: "about", icon: "information", }, ]; @@ -229,7 +229,7 @@ class SideBar extends React.Component { return ( this.props.navigation.navigate("TetrisScreen")} + onPress={() => this.props.navigation.navigate("tetris")} > { const openDrawer = getDrawerButton.bind(this, navigation); @@ -55,14 +55,14 @@ function AboutStackComponent() { }} /> { const openDrawer = getDrawerButton.bind(this, navigation); @@ -101,12 +101,12 @@ const SelfMenuStack = createStackNavigator(); function SelfMenuStackComponent() { return ( { const openDrawer = getDrawerButton.bind(this, navigation); @@ -125,12 +125,12 @@ const AvailableRoomStack = createStackNavigator(); function AvailableRoomStackComponent() { return ( { const openDrawer = getDrawerButton.bind(this, navigation); @@ -149,12 +149,12 @@ const BibStack = createStackNavigator(); function BibStackComponent() { return ( { const openDrawer = getDrawerButton.bind(this, navigation); @@ -173,12 +173,12 @@ const TetrisStack = createStackNavigator(); function TetrisStackComponent() { return ( { const openDrawer = getDrawerButton.bind(this, navigation); @@ -197,12 +197,12 @@ const LoginStack = createStackNavigator(); function LoginStackComponent() { return ( { const openDrawer = getDrawerButton.bind(this, navigation); @@ -221,12 +221,12 @@ const ProfileStack = createStackNavigator(); function ProfileStackComponent() { return ( { const openDrawer = getDrawerButton.bind(this, navigation); @@ -246,12 +246,12 @@ const VoteStack = createStackNavigator(); function VoteStackComponent() { return ( { const openDrawer = getDrawerButton.bind(this, navigation); @@ -270,12 +270,12 @@ const ClubStack = createStackNavigator(); function ClubStackComponent() { return ( { const openDrawer = getDrawerButton.bind(this, navigation); @@ -286,7 +286,7 @@ function ClubStackComponent() { }} /> { return { @@ -296,7 +296,7 @@ function ClubStackComponent() { }} /> { return { @@ -316,61 +316,88 @@ function getDrawerContent(props) { return } -export default function DrawerNavigator() { - return ( - getDrawerContent(props)} - screenOptions={defaultScreenOptions} - > - - - - - - - - - - - - - - ); +type Props = { + defaultPath: Array, + defaultData: Object +} + + +export default class DrawerNavigator extends React.Component { + + defaultRoute: string; + defaultSubRoute: string | null; + + createTabNavigator: Object; + + constructor(props: Object) { + super(props); + this.defaultRoute = 'Main'; + this.defaultSubRoute = null; + + if (props.defaultPath.length > 0) + this.defaultRoute = props.defaultPath[0]; + if (props.defaultPath.length > 1) + this.defaultSubRoute = props.defaultPath[1]; + + this.createTabNavigator = () => + } + + render() { + return ( + getDrawerContent(props)} + screenOptions={defaultScreenOptions} + > + + + + + + + + + + + + + + ); + } } diff --git a/src/navigation/MainTabNavigator.js b/src/navigation/MainTabNavigator.js index 451647f..4837d79 100644 --- a/src/navigation/MainTabNavigator.js +++ b/src/navigation/MainTabNavigator.js @@ -16,14 +16,15 @@ import AsyncStorageManager from "../managers/AsyncStorageManager"; import HeaderButton from "../components/Custom/HeaderButton"; import {withTheme} from 'react-native-paper'; import i18n from "i18n-js"; +import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen"; const TAB_ICONS = { - Home: 'triangle', - Planning: 'calendar-range', - Proxiwash: 'tshirt-crew', - Proximo: 'cart', - Planex: 'clock', + home: 'triangle', + planning: 'calendar-range', + proxiwash: 'tshirt-crew', + proximo: 'cart', + planex: 'clock', }; const defaultScreenOptions = { @@ -43,12 +44,12 @@ const ProximoStack = createStackNavigator(); function ProximoStackComponent() { return ( { const openDrawer = getDrawerButton.bind(this, navigation); return { @@ -59,14 +60,14 @@ function ProximoStackComponent() { component={ProximoMainScreen} /> { const openDrawer = getDrawerButton.bind(this, navigation); @@ -98,7 +99,7 @@ function ProxiwashStackComponent() { }} /> { const openDrawer = getDrawerButton.bind(this, navigation); @@ -130,7 +131,7 @@ function PlanningStackComponent() { }} /> { const openDrawer = getDrawerButton.bind(this, navigation); @@ -160,15 +161,26 @@ function HomeStackComponent() { headerLeft: openDrawer }; }} + initialParams={{data: defaultData, nextScreen: initialRoute}} /> + { + return { + title: "", + ...TransitionPresets.ModalSlideFromBottomIOS, + }; + }} + /> ); } @@ -178,12 +190,12 @@ const PlanexStack = createStackNavigator(); function PlanexStackComponent() { return ( { const openDrawer = getDrawerButton.bind(this, navigation); @@ -199,46 +211,71 @@ function PlanexStackComponent() { const Tab = createMaterialBottomTabNavigator(); -function TabNavigator(props) { - const {colors} = props.theme; - return ( - ({ - tabBarIcon: ({focused, color, size}) => { - let icon = TAB_ICONS[route.name]; - // tintColor is ignoring activeColor and inactiveColor for some reason - icon = focused ? icon : icon + ('-outline'); - return ; - }, - })} - activeColor={colors.primary} - inactiveColor={colors.tabIcon} - > - - - - - - - ); +type Props = { + defaultPath: Array, + defaultData: Object +} + +class TabNavigator extends React.Component{ + + createHomeStackComponent: Object; + colors: Object; + + constructor(props) { + super(props); + this.colors = props.theme.colors; + this.defaultRoute = AsyncStorageManager.getInstance().preferences.defaultStartScreen.current.toLowerCase(); + this.defaultSubRoute = null; + + if (props.defaultPath.length > 1) + this.defaultRoute = props.defaultPath[1]; + if (props.defaultPath.length > 2) + this.defaultSubRoute = props.defaultPath[2]; + + + this.createHomeStackComponent = () => HomeStackComponent(this.defaultSubRoute, props.defaultData); + } + + render() { + return ( + ({ + tabBarIcon: ({focused, color, size}) => { + let icon = TAB_ICONS[route.name]; + // tintColor is ignoring activeColor and inactiveColor for some reason + icon = focused ? icon : icon + ('-outline'); + return ; + }, + })} + activeColor={this.colors.primary} + inactiveColor={this.colors.tabIcon} + > + + + + + + + ); + } } export default withTheme(TabNavigator); diff --git a/src/screens/About/AboutScreen.js b/src/screens/About/AboutScreen.js index 4373db4..e7d843c 100644 --- a/src/screens/About/AboutScreen.js +++ b/src/screens/About/AboutScreen.js @@ -101,7 +101,7 @@ class AboutScreen extends React.Component { showChevron: true }, { - onPressCallback: () => this.props.navigation.navigate('DebugScreen'), + onPressCallback: () => this.props.navigation.navigate('debug'), icon: 'bug-check', text: i18n.t('aboutScreen.debug'), showChevron: true, @@ -165,7 +165,7 @@ class AboutScreen extends React.Component { showChevron: true }, { - onPressCallback: () => this.props.navigation.navigate('AboutDependenciesScreen'), + onPressCallback: () => this.props.navigation.navigate('dependencies'), icon: 'developer-board', text: i18n.t('aboutScreen.libs'), showChevron: true diff --git a/src/screens/Amicale/Clubs/ClubDisplayScreen.js b/src/screens/Amicale/Clubs/ClubDisplayScreen.js index 460e6d7..607fb19 100644 --- a/src/screens/Amicale/Clubs/ClubDisplayScreen.js +++ b/src/screens/Amicale/Clubs/ClubDisplayScreen.js @@ -7,6 +7,7 @@ import {Linking} from "expo"; import {Avatar, Card, Chip, Paragraph, withTheme} from 'react-native-paper'; import ImageModal from 'react-native-image-modal'; import i18n from "i18n-js"; +import AuthenticatedScreen from "../../../components/Amicale/AuthenticatedScreen"; type Props = { navigation: Object, @@ -21,13 +22,34 @@ function openWebLink(event, link) { Linking.openURL(link).catch((err) => console.error('Error opening link', err)); } +const FakeClub = { + "category": [ + 3, + 6, + ], + "description": "

Les 100 Tours de l’INSA reviennent en force pour une cinquième édition les 5 et 6 juin prochain !


Prépare-toi pour le plus gros évènement de l’année sur le campus de notre belle école qui nous réunit tous autour d’activités folles pour fêter la fin de l’année dans la bonne humeur !

L’éco-festival tournera autour d’une grande course par équipe qui nous vaut ce doux nom de 100 tours. Ce sera le moment de défier tes potes pour tenter de remporter de nombreux lots, et surtout l’admiration de tous. Mais cela ne s’arrête pas là, puisque tu pourras aussi participer à des activités à sensation, divers ateliers, et de quoi chiller avec tes potes en écoutant de la bonne musique. Tu pourras ensuite enchaîner sur LA soirée de l’année, rythmée par des artistes sur-motivés !


Tu es bien entendu le bienvenu si l’envie te prend de rejoindre l’équipe et de nous aider à organiser cet évènement du turfu !


La team 100 Tours


Contact : 100tours@amicale-insat.fr

Facebook : Les 100 Tours de l’INSA

Instagram : 100tours.insatoulouse

", + "id": 110, + "logo": "https://www.amicale-insat.fr/storage/clubLogos/2cca8885dd3bdf902124f038b548962b.jpeg", + "name": "100 Tours", + "responsibles": [ + "Juliette Duval", + "Emilie Cuminal", + "Maxime Doré", + ], +}; + /** * Class defining a planning event information page. + * If called with data and categories navigation parameters, will use those to display the data. + * If called with clubId parameter, will fetch the information on the server */ class ClubDisplayScreen extends React.Component { - displayData = this.props.route.params['data']; - categories = this.props.route.params['categories']; + displayData: Object; + categories: Object | null; + clubId: number; + + shouldFetchData: boolean; colors: Object; @@ -38,6 +60,19 @@ class ClubDisplayScreen extends React.Component { constructor(props) { super(props); this.colors = props.theme.colors; + + if (this.props.route.params.data !== undefined && this.props.route.params.categories !== undefined) { + this.displayData = this.props.route.params.data; + this.categories = this.props.route.params.categories; + this.clubId = this.props.route.params.data.id; + this.shouldFetchData = false; + } else { + this.displayData = {}; + this.categories = null; + this.clubId = this.props.route.params.clubId; + this.shouldFetchData = true; + console.log(this.clubId); + } } componentDidMount(): * { @@ -45,22 +80,28 @@ class ClubDisplayScreen extends React.Component { } getCategoryName(id: number) { - for (let i = 0; i < this.categories.length; i++) { - if (id === this.categories[i].id) - return this.categories[i].name; + if (this.categories !== null) { + for (let i = 0; i < this.categories.length; i++) { + if (id === this.categories[i].id) + return this.categories[i].name; + } } return ""; } getCategoriesRender(categories: Array) { + if (this.categories === null) + return null; + let final = []; for (let i = 0; i < categories.length; i++) { - if (categories[i] !== null) { + let cat = categories[i]; + if (cat !== null) { final.push( - {this.getCategoryName(categories[i])} + {this.getCategoryName(cat)} ); } @@ -92,11 +133,13 @@ class ClubDisplayScreen extends React.Component { ); } - render() { + getScreen = (data: Object) => { + data = FakeClub; + return ( - {this.getCategoriesRender(this.displayData.category)} - {this.displayData.logo !== null ? + {this.getCategoriesRender(data.category)} + {data.logo !== null ? { height: 300, }} source={{ - uri: this.displayData.logo, + uri: data.logo, }} /> : } - {this.displayData.description !== null ? + {data.description !== null ? // Surround description with div to allow text styling if the description is not html - " + this.displayData.description + ""} + " + data.description + ""} tagsStyles={{ p: {color: this.colors.text,}, div: {color: this.colors.text} @@ -127,9 +170,25 @@ class ClubDisplayScreen extends React.Component { onLinkPress={openWebLink}/> : } - {this.getManagersRender(this.displayData.responsibles)} + {this.getManagersRender(data.responsibles)} ); + }; + + render() { + if (this.shouldFetchData) + return ; + else + return this.getScreen(this.displayData); } } diff --git a/src/screens/Amicale/Clubs/ClubListScreen.js b/src/screens/Amicale/Clubs/ClubListScreen.js index 9ae68ca..78a77bc 100644 --- a/src/screens/Amicale/Clubs/ClubListScreen.js +++ b/src/screens/Amicale/Clubs/ClubListScreen.js @@ -71,7 +71,7 @@ class ClubListScreen extends React.Component { * @return {*} */ getHeaderButtons = () => { - const onPress = () => this.props.navigation.navigate("ClubAboutScreen"); + const onPress = () => this.props.navigation.navigate("club-about"); return ; }; @@ -186,7 +186,7 @@ class ClubListScreen extends React.Component { * @param item The article pressed */ onListItemPress(item: Object) { - this.props.navigation.navigate("ClubDisplayScreen", {data: item, categories: this.categories}); + this.props.navigation.navigate("club-information", {data: item, categories: this.categories}); } render() { diff --git a/src/screens/Amicale/LoginScreen.js b/src/screens/Amicale/LoginScreen.js index 0339beb..efdb833 100644 --- a/src/screens/Amicale/LoginScreen.js +++ b/src/screens/Amicale/LoginScreen.js @@ -63,7 +63,7 @@ class LoginScreen extends React.Component { hideErrorDialog = () => this.setState({dialogVisible: false}); - handleSuccess = () => this.props.navigation.navigate('ProfileScreen'); + handleSuccess = () => this.props.navigation.navigate('profile'); onResetPasswordClick = () => openBrowser(RESET_PASSWORD_LINK, this.colors.primary); diff --git a/src/screens/HomeScreen.js b/src/screens/HomeScreen.js index 2efbfcc..e2dd830 100644 --- a/src/screens/HomeScreen.js +++ b/src/screens/HomeScreen.js @@ -29,6 +29,7 @@ const REFRESH_TIME = 1000 * 20; // Refresh every 20 seconds type Props = { navigation: Object, + route: Object, theme: Object, } @@ -51,6 +52,9 @@ class HomeScreen extends React.Component { this.colors = props.theme.colors; this.isLoggedIn = null; + if (this.props.route.params.nextScreen !== undefined && this.props.route.params.nextScreen !== null) { + this.props.navigation.navigate(this.props.route.params.nextScreen, this.props.route.params.data); + } } /** @@ -80,8 +84,8 @@ class HomeScreen extends React.Component { getHeaderButton = () => { const screen = this.isLoggedIn - ? "ProfileScreen" - : "LoginScreen"; + ? "profile" + : "login"; const icon = this.isLoggedIn ? "account" : "login"; @@ -93,13 +97,13 @@ class HomeScreen extends React.Component { />; }; - onProxiwashClick = () => this.props.navigation.navigate('Proxiwash'); + onProxiwashClick = () => this.props.navigation.navigate('proxiwash'); onTutorInsaClick = () => openBrowser("https://www.etud.insa-toulouse.fr/~tutorinsa/", this.colors.primary); - onProximoClick = () => this.props.navigation.navigate('Proximo'); + onProximoClick = () => this.props.navigation.navigate('proximo'); - onMenuClick = () => this.props.navigation.navigate('SelfMenuScreen'); + onMenuClick = () => this.props.navigation.navigate('self-menu'); /** * Creates the dataset to be used in the FlatList @@ -338,8 +342,8 @@ class HomeScreen extends React.Component { subtitle = i18n.t('homeScreen.dashboard.todayEventsSubtitleNA'); let displayEvent = this.getDisplayEvent(futureEvents); - const clickContainerAction = () => this.props.navigation.navigate('Planning'); - const clickPreviewAction = () => this.props.navigation.navigate('PlanningDisplayScreen', {data: displayEvent}); + const clickContainerAction = () => this.props.navigation.navigate('planning'); + const clickPreviewAction = () => this.props.navigation.navigate('planning-information', {data: displayEvent}); return ( console.error('Error opening link', err)); } +const FAKE_EVENT = { + "id": 142, + "title": "Soir\u00e9e Impact'INSA", + "logo": null, + "date_begin": "2020-04-22 19:00", + "date_end": "2020-04-22 00:00", + "description": "

R\u00e9servation salle de boom + PK pour la soir\u00e9e Impact'Insa<\/p>", + "club": "Impact Insa", + "category_id": 10, + "url": "https:\/\/www.amicale-insat.fr\/event\/142\/view" +}; + /** * Class defining a planning event information page. */ class PlanningDisplayScreen extends React.Component { - displayData = this.props.route.params['data']; + displayData: Object; + shouldFetchData: boolean; + eventId: number; colors: Object; state = { - imageModalVisible: false, + }; constructor(props) { super(props); this.colors = props.theme.colors; + + if (this.props.route.params.data !== undefined) { + this.displayData = this.props.route.params.data; + this.eventId = this.props.route.params.data.eventId; + this.shouldFetchData = false; + } else { + this.displayData = FAKE_EVENT; + this.eventId = this.props.route.params.eventId; + this.shouldFetchData = true; + console.log(this.eventId); + } } - showImageModal = () => { - this.setState({imageModalVisible: true}); - }; - - hideImageModal = () => { - this.setState({imageModalVisible: false}); - }; - render() { // console.log("rendering planningDisplayScreen"); let subtitle = getFormattedEventTime( diff --git a/src/screens/Planning/PlanningScreen.js b/src/screens/Planning/PlanningScreen.js index eb340f4..b2c5212 100644 --- a/src/screens/Planning/PlanningScreen.js +++ b/src/screens/Planning/PlanningScreen.js @@ -185,7 +185,7 @@ export default class PlanningScreen extends React.Component { * @return {*} */ getRenderItem(item: eventObject) { - const onPress = this.props.navigation.navigate.bind(this, 'PlanningDisplayScreen', {data: item}); + const onPress = this.props.navigation.navigate.bind(this, 'planning-information', {data: item}); if (item.logo !== null) { return ( diff --git a/src/screens/Proximo/ProximoMainScreen.js b/src/screens/Proximo/ProximoMainScreen.js index c1b8ebd..3246591 100644 --- a/src/screens/Proximo/ProximoMainScreen.js +++ b/src/screens/Proximo/ProximoMainScreen.js @@ -95,7 +95,7 @@ class ProximoMainScreen extends React.Component { this.getAvailableArticles(this.articles, undefined) : [] }, }; - this.props.navigation.navigate('ProximoListScreen', searchScreenData); + this.props.navigation.navigate('proximo-list', searchScreenData); } /** @@ -103,7 +103,7 @@ class ProximoMainScreen extends React.Component { * This will open the ProximoAboutScreen */ onPressAboutBtn() { - this.props.navigation.navigate('ProximoAboutScreen'); + this.props.navigation.navigate('proximo-about'); } /** @@ -212,7 +212,7 @@ class ProximoMainScreen extends React.Component { data: item, }; const subtitle = item.data.length + " " + (item.data.length > 1 ? i18n.t('proximoScreen.articles') : i18n.t('proximoScreen.article')); - const onPress = this.props.navigation.navigate.bind(this, 'ProximoListScreen', dataToSend); + const onPress = this.props.navigation.navigate.bind(this, 'proximo-list', dataToSend); if (item.data.length > 0) { return ( { * This will open the ProxiwashAboutScreen. */ onAboutPress() { - this.props.navigation.navigate('ProxiwashAboutScreen'); + this.props.navigation.navigate('proxiwash-about'); } /** diff --git a/src/screens/Websites/PlanexScreen.js b/src/screens/Websites/PlanexScreen.js index 8a112fb..bf8bab1 100644 --- a/src/screens/Websites/PlanexScreen.js +++ b/src/screens/Websites/PlanexScreen.js @@ -134,7 +134,7 @@ export default class PlanexScreen extends React.Component { */ onGoToSettings() { this.onHideBanner(); - this.props.navigation.navigate('SettingsScreen'); + this.props.navigation.navigate('settings'); } render() {