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

View file

@ -4,6 +4,17 @@ import * as React from 'react';
import WebViewScreen from "../../../components/Screens/WebViewScreen";
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.
* This screen uses a webview to render the page
@ -12,6 +23,7 @@ export const WiketudWebsiteScreen = (props: Object) => {
return (
<WebViewScreen
{...props}
customPaddingFunction={customPadding}
url={URL}/>
);
};