Fixed wiketud controls hidden

This commit is contained in:
Arnaud Vergnet 2020-06-06 19:19:57 +02:00
parent 44cb35d6d9
commit 2d59912c1a
2 changed files with 16 additions and 0 deletions

View file

@ -21,6 +21,7 @@ type Props = {
theme: CustomTheme, theme: CustomTheme,
url: string, url: string,
customJS: string, customJS: string,
customPaddingFunction: null | (padding: number) => string,
collapsibleStack: Collapsible, collapsibleStack: Collapsible,
onMessage: Function, onMessage: Function,
onScroll: Function, onScroll: Function,
@ -37,6 +38,7 @@ class WebViewScreen extends React.PureComponent<Props> {
static defaultProps = { static defaultProps = {
customJS: '', customJS: '',
showAdvancedControls: true, showAdvancedControls: true,
customPaddingFunction: null,
}; };
webviewRef: Object; webviewRef: Object;
@ -157,8 +159,10 @@ class WebViewScreen extends React.PureComponent<Props> {
getRenderLoading = () => <BasicLoadingScreen isAbsolute={true}/>; getRenderLoading = () => <BasicLoadingScreen isAbsolute={true}/>;
getJavascriptPadding(padding: number) { getJavascriptPadding(padding: number) {
const customPadding = this.props.customPaddingFunction != null ? this.props.customPaddingFunction(padding) : "";
return ( return (
"document.getElementsByTagName('body')[0].style.paddingTop = '" + padding + "px';" + "document.getElementsByTagName('body')[0].style.paddingTop = '" + padding + "px';" +
customPadding +
"true;" "true;"
); );
} }

View file

@ -4,6 +4,17 @@ import * as React from 'react';
import WebViewScreen from "../../../components/Screens/WebViewScreen"; import WebViewScreen from "../../../components/Screens/WebViewScreen";
const URL = 'https://wiki.etud.insa-toulouse.fr/'; const URL = 'https://wiki.etud.insa-toulouse.fr/';
const customPadding = (padding: string) => {
return (
"$('#p-logo-text').css('top', 10 + " + padding + ");" +
"$('#site-navigation h2').css('top', 10 + " + padding + ");" +
"$('#site-tools h2').css('top', 10 + " + padding + ");" +
"$('#user-tools h2').css('top', 10 + " + padding + ");"
);
}
/** /**
* Class defining the app's available rooms screen. * Class defining the app's available rooms screen.
* This screen uses a webview to render the page * This screen uses a webview to render the page
@ -12,6 +23,7 @@ export const WiketudWebsiteScreen = (props: Object) => {
return ( return (
<WebViewScreen <WebViewScreen
{...props} {...props}
customPaddingFunction={customPadding}
url={URL}/> url={URL}/>
); );
}; };