react native webview specific code example
Example 1: react native webview
import { WebView } from "react-native-webview";
<WebView
source={{
uri:
"https://www.google.com"
}}
/>
Example 2: react native webview
import React from 'react'
import { StyleSheet, SafeView, WebView, View, Text } from 'react-native'
const App = () => (
<SafeView>
<View style={styles.container}>
<WebView
source={{
uri: 'https://reactjs.org/',
headers: {
'Access-Control-Allow-Methods': '*',
'Access-Control-Allow-Origin': '*'
}
}}
renderLoading={() => <Text style={styles.loading}>Loading...</Text>}
startInLoadingState
domStorageEnabled
geolocationEnabled
allowUniversalAccessFromFileURLs
allowFileAccess
/>
</View>
</SafeView>
)
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 0,
margin: 0
},
loading: {
fontSize: 24,
fontWeight: 'bold'
}
})
export default App