Application Android et IOS pour l'amicale des élèves https://play.google.com/store/apps/details?id=fr.amicaleinsat.application
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PlanexScreen.js 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // @flow
  2. import * as React from 'react';
  3. import {Platform, View} from 'react-native';
  4. import {Spinner} from 'native-base';
  5. import WebView from "react-native-webview";
  6. import Touchable from "react-native-platform-touchable";
  7. import CustomMaterialIcon from "../components/CustomMaterialIcon";
  8. import ThemeManager from "../utils/ThemeManager";
  9. import BaseContainer from "../components/BaseContainer";
  10. type Props = {
  11. navigation: Object,
  12. }
  13. const PLANEX_URL = 'http://planex.insa-toulouse.fr/';
  14. /**
  15. * Class defining the app's planex screen.
  16. * This screen uses a webview to render the planex page
  17. */
  18. export default class PlanningScreen extends React.Component<Props> {
  19. webview: WebView;
  20. getRefreshButton() {
  21. return (
  22. <Touchable
  23. style={{padding: 6}}
  24. onPress={() => this.refreshWebview()}>
  25. <CustomMaterialIcon
  26. color={Platform.OS === 'ios' ? ThemeManager.getCurrentThemeVariables().brandPrimary : "#fff"}
  27. icon="refresh"/>
  28. </Touchable>
  29. );
  30. };
  31. refreshWebview() {
  32. this.webview.reload();
  33. }
  34. render() {
  35. const nav = this.props.navigation;
  36. return (
  37. <BaseContainer navigation={nav} headerTitle={'Planex'} headerRightButton={this.getRefreshButton()}>
  38. <WebView
  39. ref={ref => (this.webview = ref)}
  40. source={{uri: PLANEX_URL}}
  41. style={{
  42. width: '100%',
  43. height: '100%',
  44. }}
  45. startInLoadingState={true}
  46. renderLoading={() =>
  47. <View style={{
  48. backgroundColor: ThemeManager.getCurrentThemeVariables().containerBgColor,
  49. position: 'absolute',
  50. top: 0,
  51. right: 0,
  52. width: '100%',
  53. height: '100%',
  54. flex: 1,
  55. alignItems: 'center',
  56. justifyContent: 'center'
  57. }}>
  58. <Spinner/>
  59. </View>
  60. }
  61. />
  62. </BaseContainer>
  63. );
  64. }
  65. }