forked from vergnet/application-amicale
Fixed body padding not applying on some cases
This commit is contained in:
parent
ef23280493
commit
b336c95f20
2 changed files with 3 additions and 29 deletions
|
@ -114,7 +114,6 @@ class WebViewScreen extends React.PureComponent<Props> {
|
||||||
onOpenClicked = () => Linking.openURL(this.props.url);
|
onOpenClicked = () => Linking.openURL(this.props.url);
|
||||||
|
|
||||||
injectJavaScript = (script: string) => {
|
injectJavaScript = (script: string) => {
|
||||||
// console.log(this.webviewRef.current.getNode().webViewRef.current);
|
|
||||||
this.webviewRef.current.getNode().injectJavaScript(script);
|
this.webviewRef.current.getNode().injectJavaScript(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,46 +124,21 @@ class WebViewScreen extends React.PureComponent<Props> {
|
||||||
*/
|
*/
|
||||||
getRenderLoading = () => <BasicLoadingScreen isAbsolute={true}/>;
|
getRenderLoading = () => <BasicLoadingScreen isAbsolute={true}/>;
|
||||||
|
|
||||||
// document.getElementsByTagName('body')[0].style.paddingTop = '100px';
|
|
||||||
|
|
||||||
// $( 'body *' ).filter(function(){
|
|
||||||
// var position = $(this).css('position');
|
|
||||||
// var top = $(this).css('top');
|
|
||||||
// if((position === 'fixed') && top !== 'auto'){
|
|
||||||
// console.log(top);
|
|
||||||
// $(this).css('top', 'calc(' + top + ' + 100px)');
|
|
||||||
// console.log($(this).css('top'));
|
|
||||||
// };
|
|
||||||
// });
|
|
||||||
|
|
||||||
// document.querySelectorAll('body *').forEach(function(node){
|
|
||||||
// var style = window.getComputedStyle(node);
|
|
||||||
// var position = style.getPropertyValue('position');
|
|
||||||
// var top = style.getPropertyValue('top');
|
|
||||||
// if((position === 'fixed') && top !== 'auto'){
|
|
||||||
// console.log(top);
|
|
||||||
// node.style.top = 'calc(' + top + ' + 100px)';
|
|
||||||
// console.log(node.style.top);
|
|
||||||
// console.log(node);
|
|
||||||
// };
|
|
||||||
// });
|
|
||||||
|
|
||||||
getJavascriptPadding(padding: number) {
|
getJavascriptPadding(padding: number) {
|
||||||
return (
|
return (
|
||||||
"document.getElementsByTagName('body')[0].style.paddingTop = '" + padding + "px';\n" +
|
"document.getElementsByTagName('body')[0].style.paddingTop = '" + padding + "px';" +
|
||||||
"true;"
|
"true;"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {containerPaddingTop, onScrollWithListener} = this.props.collapsibleStack;
|
const {containerPaddingTop, onScrollWithListener} = this.props.collapsibleStack;
|
||||||
const customJS = this.getJavascriptPadding(containerPaddingTop);
|
|
||||||
return (
|
return (
|
||||||
<AnimatedWebView
|
<AnimatedWebView
|
||||||
ref={this.webviewRef}
|
ref={this.webviewRef}
|
||||||
source={{uri: this.props.url}}
|
source={{uri: this.props.url}}
|
||||||
startInLoadingState={true}
|
startInLoadingState={true}
|
||||||
injectedJavaScript={this.props.customJS + customJS}
|
injectedJavaScript={this.props.customJS}
|
||||||
javaScriptEnabled={true}
|
javaScriptEnabled={true}
|
||||||
renderLoading={this.getRenderLoading}
|
renderLoading={this.getRenderLoading}
|
||||||
renderError={() => <ErrorView
|
renderError={() => <ErrorView
|
||||||
|
@ -175,6 +149,7 @@ class WebViewScreen extends React.PureComponent<Props> {
|
||||||
this.canGoBack = navState.canGoBack;
|
this.canGoBack = navState.canGoBack;
|
||||||
}}
|
}}
|
||||||
onMessage={this.props.onMessage}
|
onMessage={this.props.onMessage}
|
||||||
|
onLoad={() => this.injectJavaScript(this.getJavascriptPadding(containerPaddingTop))}
|
||||||
// Animations
|
// Animations
|
||||||
onScroll={onScrollWithListener(this.props.onScroll)}
|
onScroll={onScrollWithListener(this.props.onScroll)}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -204,7 +204,6 @@ class PlanexScreen extends React.Component<Props, State> {
|
||||||
'removeAlpha();'
|
'removeAlpha();'
|
||||||
+ '});'
|
+ '});'
|
||||||
+ EXEC_COMMAND
|
+ EXEC_COMMAND
|
||||||
+ "function cc(msg) {alert(msg)};"
|
|
||||||
+ 'true;'; // Prevents crash on ios
|
+ 'true;'; // Prevents crash on ios
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue