Open In App

React Native WebView Component

In this article, We are going to see how to create a WebView in react-native. WebView is used to display web content in an application. For this, we are going to use WebView Component. 

Syntax : 



<WebView
    source={}
/>

Props of WebView : 

Methods in WebView : 



Now let’s start with the implementation:

Project Structure : 

Example: Now let’s implement the WebView. Here we are going to render the GeeksforGeeks website in our webview.




import React from 'react';
import { WebView } from 'react-native-webview';
export default function App() {
  
  return (
    <WebView source={{ uri: 'https://geeksforgeeks.org/' }} />
  );
}

Start the server by using the following command.

npm run android

Output: If your emulator did not open automatically then you need to do it manually. First, go to your android studio and run the emulator. Now start the server again. 


Article Tags :