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.

AvailableRoomScreen.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // @flow
  2. import * as React from 'react';
  3. import WebViewScreen from "../../../components/Screens/WebViewScreen";
  4. type Props = {
  5. navigation: Object,
  6. }
  7. const ROOM_URL = 'http://planex.insa-toulouse.fr/salles.php';
  8. const CUSTOM_CSS_GENERAL = 'https://etud.insa-toulouse.fr/~amicale_app/custom_css/rooms/customMobile2.css';
  9. /**
  10. * Class defining the app's available rooms screen.
  11. * This screen uses a webview to render the page
  12. */
  13. export default class AvailableRoomScreen extends React.Component<Props> {
  14. customInjectedJS: string;
  15. /**
  16. * Defines custom injected JavaScript to improve the page display on mobile
  17. */
  18. constructor() {
  19. super();
  20. this.customInjectedJS =
  21. 'document.querySelector(\'head\').innerHTML += \'<meta name="viewport" content="width=device-width, initial-scale=1.0">\';' +
  22. 'document.querySelector(\'head\').innerHTML += \'<link rel="stylesheet" href="' + CUSTOM_CSS_GENERAL + '" type="text/css"/>\';' +
  23. 'let header = $(".table tbody tr:first");' +
  24. '$("table").prepend("<thead></thead>");true;' + // Fix for crash on ios
  25. '$("thead").append(header);true;';
  26. }
  27. render() {
  28. const nav = this.props.navigation;
  29. return (
  30. <WebViewScreen
  31. navigation={nav}
  32. url={ROOM_URL}
  33. customJS={this.customInjectedJS}/>
  34. );
  35. }
  36. }