I am using "WebView" in react-native for rendering a web page. The web page doesn't have mobile-friendly UI.
When I open it in Chrome Browser, it looks like below. AND I WANT TO RENDER IT LIKE BELOW
But When I render below code, it looks like the image shown below.
Please see that I have tried different props automaticallyAdjustContentInsets = {false}
, scalesPageToFit={false}
. But it's not giving me the desire output.
render(){
const URL = "https://stellarterm.com";
return(
<WebView
source={{URL}}
/>
Result
Please feel free to suggest any solution if you have. Any third party library will also be okay.
Your site has page width set in meta already <meta name="viewport" content="width=1080">
So you will need to override that with injectedJavaScript
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}
The user-scalable
property on the selected answer's injection must be set to 1 to enable manual screen scaling.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With