Application Android et IOS pour l'amicale des élèves
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.

SelfMenuScreen.js 2.4KB

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