React Native Web View Example

04-Apr-2023

.

Admin

React Native Web View Example

Hi Guys,

In this tutorial, I will learn you how to load web content in your app using react native.

Here, i will give you complete example for loading web page in your application using react-native-webview component in react native as bellow.

Step 1 - Create project


In the first step Run the following command for create project.

expo init nicesnippetsApp

Step 2 - Install Package

In the step,I will install react-native-webview.

yarn add react-native-webview

Step 3 - App.js

In this step, You will open App.js file and put the code.

import React, { Component } from 'react'

import { View, StyleSheet, AppRegistry } from 'react-native'

import { WebView } from 'react-native-webview'

export default class nicesnippetsApp extends Component {

render() {

return (

<View style = {styles.container}>

<WebView

source = {{ uri:'https://www.nicesnippets.com' }}

/>

</View>

)

}

}

const styles = StyleSheet.create({

container: {

flex: 1,

}

})

AppRegistry.registerComponent('App', () => nicesnippetsApp)

Step 4 - Run project

In the last step run your project using bellow command.

npm start

Output

It will help you...

#React Native