React Native WebView打开网页自动适应页面大小

参考文章:https://stackoverflow.com/questions/50110920/how-to-zoom-out-in-webview-in-react-native

<WebView
injectedJavaScript={
`const meta = document.createElement(‘meta’);
meta.setAttribute(‘content’, ‘width=device-width, initial-scale=0.5, maximum-scale=0.5, user-scalable=0’);
meta.setAttribute(‘name’, ‘viewport’);
document.getElementsByTagName(‘head’)[0].appendChild(meta); `
}
scalesPageToFit={false}
/>

 



发表评论

邮箱地址不会被公开。