From 7d7b17765d52d32b37bafe69959ef9f147247452 Mon Sep 17 00:00:00 2001 From: keplyx Date: Thu, 8 Aug 2019 13:57:03 +0200 Subject: [PATCH] Added self menu,added screen animations, improved themes --- App.js | 4 +- components/Sidebar.js | 17 ++--- native-base-theme/variables/platformDark.js | 8 +-- navigation/AppNavigator.js | 6 +- package-lock.json | 5 ++ package.json | 3 +- screens/HomeScreen.js | 2 +- screens/PlanexScreen.js | 17 ++--- screens/ProxiwashScreen.js | 15 ++-- screens/SelfMenuScreen.js | 78 +++++++++++++++++++++ translations/en.json | 1 + translations/fr.json | 1 + 12 files changed, 118 insertions(+), 39 deletions(-) create mode 100644 screens/SelfMenuScreen.js diff --git a/App.js b/App.js index 97494d1..bff963c 100644 --- a/App.js +++ b/App.js @@ -51,8 +51,8 @@ export default class App extends React.Component { this.setState({ isLoading: false, currentTheme: ThemeManager.getCurrentTheme(), - // showIntro: AsyncStorageManager.getInstance().preferences.showIntro.current === '1' - showIntro: true + showIntro: AsyncStorageManager.getInstance().preferences.showIntro.current === '1' + // showIntro: true }); } diff --git a/components/Sidebar.js b/components/Sidebar.js index b14a903..afac00a 100644 --- a/components/Sidebar.js +++ b/components/Sidebar.js @@ -12,6 +12,7 @@ const drawerCover = require("../assets/drawer-cover.png"); const WIKETUD_LINK = "https://www.etud.insa-toulouse.fr/wiketud"; const Amicale_LINK = "https://www.etud.insa-toulouse.fr/~amicale"; +const RU_LINK = "http://m.insa-toulouse.fr/ru.html"; type Props = { navigation: Object, @@ -54,16 +55,11 @@ export default class SideBar extends React.Component { icon: "wikipedia", link: WIKETUD_LINK }, - // { - // name: i18n.t('screens.settings'), - // route: "Settings", - // icon: "settings", - // }, - // { - // name: i18n.t('screens.about'), - // route: "About", - // icon: "information", - // }, + { + name: i18n.t('screens.menuSelf'), + route: "SelfMenuScreen", + icon: "silverware-fork-knife", + }, ]; } @@ -73,7 +69,6 @@ export default class SideBar extends React.Component { */ navigateToScreen(route: string) { this.props.navigation.navigate(route); - this.props.navigation.closeDrawer(); }; render() { diff --git a/native-base-theme/variables/platformDark.js b/native-base-theme/variables/platformDark.js index a5bf15f..ef6c7b3 100644 --- a/native-base-theme/variables/platformDark.js +++ b/native-base-theme/variables/platformDark.js @@ -115,7 +115,7 @@ export default { brandLight: "#f4f4f4", //Container - containerBgColor: "#333333", + containerBgColor: "#222222", //Date Picker datePickerTextColor: "#fff", @@ -150,7 +150,7 @@ export default { // Header toolbarBtnColor: platform === "ios" ? "#be1522" : "#fff", - toolbarDefaultBg: platform === "ios" ? "#F8F8F8" : "#be1522", + toolbarDefaultBg: platform === "ios" ? "#333333" : "#be1522", toolbarHeight: platform === "ios" ? 64 : 56, toolbarSearchIconSize: platform === "ios" ? 20 : 23, toolbarInputColor: platform === "ios" ? "#CECDD2" : "#fff", @@ -241,7 +241,7 @@ export default { tabFontSize: 15, // Text - textColor: "#d6d6d6", + textColor: "#ebebeb", inverseTextColor: "#000", noteFontSize: 14, get defaultTextColor() { @@ -253,7 +253,7 @@ export default { titleFontSize: platform === "ios" ? 17 : 19, subTitleFontSize: platform === "ios" ? 11 : 14, subtitleColor: platform === "ios" ? "#8e8e93" : "#FFF", - titleFontColor: platform === "ios" ? "#000" : "#FFF", + titleFontColor: platform === "ios" ? "#FFF" : "#FFF", // CUSTOM diff --git a/navigation/AppNavigator.js b/navigation/AppNavigator.js index 9e8101c..9c04aea 100644 --- a/navigation/AppNavigator.js +++ b/navigation/AppNavigator.js @@ -6,6 +6,8 @@ import SettingsScreen from '../screens/SettingsScreen'; import AboutScreen from '../screens/About/AboutScreen'; import ProximoListScreen from '../screens/Proximo/ProximoListScreen'; import AboutDependenciesScreen from '../screens/About/AboutDependenciesScreen'; +import SelfMenuScreen from '../screens/SelfMenuScreen'; +import {fromRight} from "react-navigation-transitions"; /** * Create a stack navigator using the drawer to handle navigation between screens @@ -18,10 +20,12 @@ export default createAppContainer( SettingsScreen: {screen: SettingsScreen}, AboutScreen: {screen: AboutScreen}, AboutDependenciesScreen: {screen: AboutDependenciesScreen}, + SelfMenuScreen: {screen: SelfMenuScreen}, }, { initialRouteName: "Main", mode: 'card', - headerMode: "none" + headerMode: "none", + transitionConfig: () => fromRight(), }) ); diff --git a/package-lock.json b/package-lock.json index 0732ec4..d282018 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6372,6 +6372,11 @@ "react-native-tab-view": "^1.4.1" } }, + "react-navigation-transitions": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/react-navigation-transitions/-/react-navigation-transitions-1.0.12.tgz", + "integrity": "sha512-Hp0wX9KoXwsFch6Fgiz9HpGjQZDhnyucLbCai0LcaOC3VpmgYmvkbeAg/mQ5Z5exuY6PPrh/+FXU00yMPDHkcw==" + }, "react-proxy": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/react-proxy/-/react-proxy-1.1.8.tgz", diff --git a/package.json b/package.json index 4a6cd3d..07c125d 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "react-native-status-bar-height": "^2.3.1", "react-native-webview": "^5.8.1", "react-navigation": "^3.11.0", - "react-navigation-material-bottom-tabs": "^1.0.0" + "react-navigation-material-bottom-tabs": "^1.0.0", + "react-navigation-transitions": "^1.0.12" }, "devDependencies": { "babel-preset-expo": "^5.1.1", diff --git a/screens/HomeScreen.js b/screens/HomeScreen.js index 24d6ee9..a2d95d4 100644 --- a/screens/HomeScreen.js +++ b/screens/HomeScreen.js @@ -76,7 +76,7 @@ export default class HomeScreen extends FetchedDataSectionList { }}> - + {NAME_AMICALE} {HomeScreen.getFormattedDate(item.created_time)} diff --git a/screens/PlanexScreen.js b/screens/PlanexScreen.js index c9efe47..f34db8e 100644 --- a/screens/PlanexScreen.js +++ b/screens/PlanexScreen.js @@ -13,23 +13,14 @@ type Props = { navigation: Object, } -type State = { - isFinishedLoading: boolean -} -// const PLANEX_URL = 'http://planex.insa-toulouse.fr/'; -// TODO use real url in prod -const PLANEX_URL = 'https://srv-falcon.etud.insa-toulouse.fr/~vergnet/planex/planex.insa-toulouse.fr.html'; +const PLANEX_URL = 'http://planex.insa-toulouse.fr/'; /** * Class defining the app's planex screen. * This screen uses a webview to render the planex page */ -export default class PlanningScreen extends React.Component { - - state = { - isFinishedLoading: false, - }; +export default class PlanningScreen extends React.Component { webview: WebView; @@ -46,7 +37,6 @@ export default class PlanningScreen extends React.Component { }; refreshWebview() { - this.setState({isFinishedLoading: false}); this.webview.reload(); } @@ -65,6 +55,9 @@ export default class PlanningScreen extends React.Component { renderLoading={() => { + + webview: WebView; + + getRefreshButton() { + return ( + this.refreshWebview()}> + + + ); + }; + + refreshWebview() { + this.webview.reload(); + } + + render() { + const nav = this.props.navigation; + return ( + + + (this.webview = ref)} + source={{uri: RU_URL}} + style={{ + width: '100%', + height: '100%', + }} + startInLoadingState={true} + renderLoading={() => + + + + } + /> + + ); + } +} + diff --git a/translations/en.json b/translations/en.json index 00f5790..0f745ec 100644 --- a/translations/en.json +++ b/translations/en.json @@ -4,6 +4,7 @@ "planning": "Planning", "proxiwash": "Proxiwash", "proximo": "Proximo", + "menuSelf": "UR Menu", "settings": "Settings", "about": "About" }, diff --git a/translations/fr.json b/translations/fr.json index 498621b..df73b79 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -4,6 +4,7 @@ "planning": "Planning", "proxiwash": "Proxiwash", "proximo": "Proximo", + "menuSelf": "Menu Ru", "settings": "Paramètres", "about": "À Propos" },