Skip to content

Instantly share code, notes, and snippets.

@herbertdai
Created March 30, 2016 13:18
Show Gist options
  • Save herbertdai/7bf8fd8a6194037089d2d20b4fde8c0b to your computer and use it in GitHub Desktop.
Save herbertdai/7bf8fd8a6194037089d2d20b4fde8c0b to your computer and use it in GitHub Desktop.
const script = `<script>window.location.hash = 1;document.title = document.getElementsByTagName('html')[0].scrollHeight;</script>`;
onNavigationStateChange(navState) {
Util.log("webView Height:", navState.title);
this.setState({
height: navState.title
});
}
renderMobileBody(){
return(
<WebView
automaticallyAdjustContentInsets={false}
style={[styles.webView, {height: Number(this.state.height)}]}
source={{html: this.htmls + script}}
onNavigationStateChange={this.onNavigationStateChange.bind(this)}
javaScriptEnabled={true}
domStorageEnabled={true}
scalesPageToFit={true}
decelerationRate="normal"
javaScriptEnabledAndroid={true}
/>
);
}
@javadoffuad
Copy link

it's work.
I can take html height.
But how to calculate px height to dp?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment