2018-08-16 02:23:26 +00:00
# React Native WebView - a Modern, Cross-Platform WebView for React Native
2018-08-13 04:52:47 +00:00
2018-09-08 17:42:02 +00:00
**React Native WebView** is a modern, well-supported, and cross-platform WebView for React Native. It is intended to be a replacement for the built-in WebView (which will be [removed from core ](https://github.com/react-native-community/discussions-and-proposals/pull/3 )).
2018-08-13 04:52:47 +00:00
## Platforms Supported
2018-09-09 00:03:46 +00:00
* [x] iOS (both UIWebView and WKWebView)
2018-08-13 04:52:47 +00:00
* [x] Android
* [ ] Windows 10 (coming soon)
## Installation
```
2018-08-16 02:23:26 +00:00
$ npm install --save react-native-webview
$ react-native link react-native-webview
2018-08-13 04:52:47 +00:00
```
## Usage
2018-08-16 02:23:26 +00:00
Import the `WebView` component from `react-native-webview` and use it like so:
2018-08-13 04:52:47 +00:00
```jsx
import React, { Component } from 'react'
import { StyleSheet, Text, View } from 'react-native'
2018-08-16 02:23:26 +00:00
import { WebView } from 'react-native-webview'
2018-08-13 04:52:47 +00:00
// ...
class MyWebComponent extends Component {
render () {
return (
< WebView
2018-09-09 00:03:46 +00:00
useWebKit // to use WKWebView -- will be default at some point
src={{uri: "https://infinite.red/react-native"}}
2018-08-13 04:52:47 +00:00
style={{marginTop: 20}}
/>
)
}
}
```
Additional properties are supported and will be added here; for now, refer to the previous React Native WebView documentation for more.
[https://facebook.github.io/react-native/docs/webview ](https://facebook.github.io/react-native/docs/webview )
2018-08-16 02:23:26 +00:00
## Migrate from React Native core WebView to React Native WebView
2018-08-13 04:52:47 +00:00
2018-08-16 02:23:26 +00:00
Simply install React Native WebView and then use it in place of the core WebView. Their APIs are currently identical.
2018-08-13 04:52:47 +00:00
2018-09-08 17:42:02 +00:00
### Contributor Notes
2018-09-09 00:03:46 +00:00
* I've removed all PropTypes for now. Instead, we'll be moving toward Flow or TypeScript at a later date
2018-09-08 17:42:02 +00:00
2018-08-13 04:52:47 +00:00
## Maintainers
* [Jamon Holmgren ](https://github.com/jamonholmgren ) ([Twitter](https://twitter.com/jamonholmgren)) from [Infinite Red ](https://infinite.red/react-native )
## License
MIT