Added planex webview

This commit is contained in:
keplyx 2019-08-06 19:18:45 +02:00
parent c60fb5291c
commit a663d8256a
8 changed files with 73 additions and 15 deletions

View file

@ -10,7 +10,7 @@
"android",
"web"
],
"version": "0.0.5",
"version": "0.0.6",
"orientation": "portrait",
"primaryColor": "#e42612",
"icon": "./assets/icon.png",
@ -32,7 +32,7 @@
],
"ios": {
"bundleIdentifier": "amicale.insat.application",
"buildNumber": "0.0.5",
"buildNumber": "0.0.6",
"icon": "./assets/ios.icon.png"
},
"android": {

View file

@ -12,7 +12,6 @@ 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 TIMETABLE_LINK = "http://planex.insa-toulouse.fr";
type Props = {
navigation: Object,
@ -63,18 +62,17 @@ export default class SideBar extends React.Component<Props, State> {
route: "Proximo",
icon: "shopping",
},
{
name: 'Planex',
route: "Planex",
icon: "timetable",
},
{
name: "Amicale",
route: "amicale",
icon: "web",
link: Amicale_LINK
},
{
name: i18n.t('screens.timetable'),
route: "timetable",
icon: "timetable",
link: TIMETABLE_LINK
},
{
name: "Wiketud",
route: "wiketud",
@ -120,7 +118,7 @@ export default class SideBar extends React.Component<Props, State> {
renderItem={({item}) =>
<ListItem
button
noBorder={item.name !== 'Wiketud' && item.name !== 'Proximo'} // Display a separator before settings and Amicale
noBorder={item.name !== 'Wiketud' && item.name !== 'Planex'} // Display a separator before settings and Amicale
selected={this.state.active === item.route}
onPress={() => {
if (item.link !== undefined)

View file

@ -7,6 +7,7 @@ import HomeScreen from '../screens/HomeScreen';
import PlanningScreen from '../screens/PlanningScreen';
import ProxiwashScreen from '../screens/ProxiwashScreen';
import ProximoMainScreen from '../screens/Proximo/ProximoMainScreen';
import PlanexScreen from '../screens/PlanexScreen';
import SettingsScreen from '../screens/SettingsScreen';
import AboutScreen from '../screens/About/AboutScreen';
import SideMenu from "../components/SideMenu";
@ -19,6 +20,7 @@ export default createDrawerNavigator({
Planning: {screen: PlanningScreen,},
Proxiwash: {screen: ProxiwashScreen,},
Proximo: {screen: ProximoMainScreen,},
Planex: {screen: PlanexScreen},
Settings: {screen: SettingsScreen,},
About: {screen: AboutScreen,},
}, {

15
package-lock.json generated
View file

@ -2595,6 +2595,15 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/expo-linear-gradient/-/expo-linear-gradient-5.0.1.tgz",
"integrity": "sha512-5dKn9JIXmXXHq6itC/Jpqo65Tkgjwacyw1kpD8sekoFTEVfT6ciFd2djqIcciUqIa57FF/5d2q54mUvjoqD/TA=="
},
"react-native-webview": {
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/react-native-webview/-/react-native-webview-5.8.1.tgz",
"integrity": "sha512-b6pSvmjoiWtcz6YspggW02X+BRXJWuquHwkh37BRx1NMW1iwMZA31SnFQvTpPzWYYIb9WF/mRsy2nGtt9C6NIg==",
"requires": {
"escape-string-regexp": "1.0.5",
"invariant": "2.2.4"
}
}
}
},
@ -5998,9 +6007,9 @@
"integrity": "sha512-yO9vWi/11m2hEJl8FrW1SMeVzFfPtMKh20MUInGqlsL0H8Ya2JGGlFfrBzx1KiFR2hFb5OdsTLYNtcVZtJ6pLQ=="
},
"react-native-webview": {
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/react-native-webview/-/react-native-webview-5.8.1.tgz",
"integrity": "sha512-b6pSvmjoiWtcz6YspggW02X+BRXJWuquHwkh37BRx1NMW1iwMZA31SnFQvTpPzWYYIb9WF/mRsy2nGtt9C6NIg==",
"version": "5.12.1",
"resolved": "https://registry.npmjs.org/react-native-webview/-/react-native-webview-5.12.1.tgz",
"integrity": "sha512-pFYzyNUG+k7Jk2a0Z3S1+OL9qtp0VQxVP08d1ume/O6l1Xibi0K0hRZms7zPUHqQc2uWEfjZ0FOa17MIN7vruw==",
"requires": {
"escape-string-regexp": "1.0.5",
"invariant": "2.2.4"

View file

@ -25,6 +25,7 @@
"react-native-autolink": "^1.8.1",
"react-native-platform-touchable": "^1.1.1",
"react-native-status-bar-height": "^2.3.1",
"react-native-webview": "^5.8.1",
"react-navigation": "^3.11.0"
},
"devDependencies": {

50
screens/PlanexScreen.js Normal file
View file

@ -0,0 +1,50 @@
// @flow
import * as React from 'react';
import {View} from 'react-native';
import {Container, Content, Spinner} from 'native-base';
import CustomHeader from "../components/CustomHeader";
import WebView from "react-native-webview";
type Props = {
navigation: Object,
}
type State = {
isFinishedLoading: boolean
}
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<Props, State> {
state = {
isFinishedLoading: false,
};
render() {
const nav = this.props.navigation;
return (
<Container>
<CustomHeader navigation={nav} title={'Planex'}/>
<WebView
source={{uri: PLANEX_URL}}
style={{width: this.state.isFinishedLoading ? '100%' : 0}}
onLoadEnd={() => {
this.setState({isFinishedLoading: true})
}}
/>
{this.state.isFinishedLoading ?
<View/> :
<Content>
<Spinner/>
</Content>}
</Container>
);
}
}

View file

@ -4,7 +4,6 @@
"planning": "Planning",
"proxiwash": "Proxiwash",
"proximo": "Proximo",
"timetable": "Timetable",
"settings": "Settings",
"about": "About"
},

View file

@ -4,7 +4,6 @@
"planning": "Planning",
"proxiwash": "Proxiwash",
"proximo": "Proximo",
"timetable": "Emploi du temps",
"settings": "Paramètres",
"about": "À Propos"
},