react native webiview code example

Example: 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