參考:https://www.zhihu.com/question/42864534
<WebView javaScriptEnabled={true} source={{ html: HTML }} style={{ height: this.state.WebViewHeight,width:Width }} onNavigationStateChange={(info)=>{ this.setState({WebViewHeight:info.url.replace('about:blank%23','')/1 + 20 }) }} scrollEnabled={false} />
window.onload = function(){ var height = document.body.clientHeight; window.location.hash = '#' + height; }
這只是一個思路,這里有一個Github項目GitHub - alinz/react-native-webview-bridge: React Native Webview with Javascript Bridge**可以讓WebView和React的JS進行通信。
作者:劉開鏈接:https://www.zhihu.com/question/42864534/answer/115386718來源:知乎著作權歸作者所有,轉載請聯(lián)系作者獲得授權。