1

I am using webview at React native with Expo.

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { WebView } from 'react-native';


export default function App() {
  return <WebView source={{ uri: 'http://192.0.0.1:8080' }} />;
}

This is my webiew code.
But I want to fix the webview without resizing with finger. How can I set this option? thank you so much.

DD DD
  • 1,148
  • 1
  • 10
  • 33

1 Answers1

1

Please check below example and let me know if you can do it or not.

const INJECTEDJAVASCRIPT = `const meta = document.createElement('meta'); meta.setAttribute('content', 'width='100%', initial-scale=1.0, maximum-scale=1.0, user-scalable=0'); meta.setAttribute('name', 'viewport'); document.getElementsByTagName('head')[0].appendChild(meta); `

   <WebView 
      ref={(reff) => {
              this.webView = reff;
           }}
            bounces={false}
            automaticallyAdjustContentInsets={false}
            injectedJavaScript={INJECTEDJAVASCRIPT}
            startInLoadingState
            javaScriptEnabled ={true}

        />
Sai kiran
  • 237
  • 3
  • 15