UNPKG

4.25 kBMarkdownView Raw
1# React Native WebView
2
3![star this repo](https://img.shields.io/github/stars/react-native-webview/react-native-webview?style=flat-square)
4[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
5[![NPM Version](https://img.shields.io/npm/v/react-native-webview.svg?style=flat-square)](https://www.npmjs.com/package/react-native-webview)
6![Npm Downloads](https://img.shields.io/npm/dm/react-native-webview.svg)
7
8**React Native WebView** is a community-maintained WebView component for React Native. It is intended to be a replacement for the built-in WebView (which was [removed from core](https://github.com/react-native-community/discussions-and-proposals/pull/3)).
9
10### Maintainers
11
12**Many thanks to these companies** for providing us with time to work on open source.
13Please note that maintainers spend a lot of free time working on this too so feel free to sponsor them, **it really makes a difference.**
14
15- [Thibault Malbranche](https://github.com/Titozzz) ([Twitter @titozzz](https://twitter.com/titozzz)) from [Brigad](https://www.brigad.co/en-gb/about-us)
16[*Sponsor me* ❤️ !](https://github.com/sponsors/Titozzz)
17
18
19Windows and macOS are managed by Microsoft, notably:
20- [Alexander Sklar](https://github.com/asklar) ([Twitter @alexsklar](https://twitter.com/alexsklar)) from [React Native for Windows](https://microsoft.github.io/react-native-windows/)
21- [Chiara Mooney](https://github.com/chiaramooney) from [React Native for Windows @ Microsoft](https://microsoft.github.io/react-native-windows/)
22
23Shout-out to [Jamon Holmgren](https://github.com/jamonholmgren) from [Infinite Red](https://infinite.red) for helping a lot with the repo when he had more available time.
24
25### Disclaimer
26
27Maintaining WebView is very complex because it is often used for many different use cases (rendering SVGs, PDFs, login flows, and much more). We also support many platforms and both architectures of react-native.
28
29Since WebView was extracted from the React Native core, nearly 500 pull requests have been merged.
30Considering that we have limited time, issues will mostly serve as a discussion place for the community, while **we will prioritize reviewing and merging pull requests.**
31
32### Platform compatibility
33
34This project is compatible with **iOS**, **Android**, **Windows** and **macOS**.
35This project supports both **the old** (paper) **and the new architecture** (fabric).
36This project is compatible with [expo](https://docs.expo.dev/versions/latest/sdk/webview/).
37
38### Getting Started
39
40Read our [Getting Started Guide](docs/Getting-Started.md). If any step seems unclear, please create a pull request.
41
42### Versioning
43
44This project follows [semantic versioning](https://semver.org/). We do not hesitate to release breaking changes but they will be in a major version.
45
46### Usage
47
48Import the `WebView` component from `react-native-webview` and use it like so:
49
50```tsx
51import React, { Component } from 'react';
52import { StyleSheet, Text, View } from 'react-native';
53import { WebView } from 'react-native-webview';
54
55// ...
56const MyWebComponent = () => {
57 return <WebView source={{ uri: 'https://reactnative.dev/' }} style={{ flex: 1 }} />;
58}
59```
60
61For more, read the [API Reference](./docs/Reference.md) and [Guide](./docs/Guide.md). If you're interested in contributing, check out the [Contributing Guide](./docs/Contributing.md).
62
63### Common issues
64
65- If you're getting `Invariant Violation: Native component for "RNCWebView does not exist"` it likely means you forgot to run `react-native link` or there was some error with the linking process
66- If you encounter a build error during the task `:app:mergeDexRelease`, you need to enable multidex support in `android/app/build.gradle` as discussed in [this issue](https://github.com/react-native-webview/react-native-webview/issues/1344#issuecomment-650544648)
67
68#### Contributing
69
70Contributions are welcome, see [Contributing.md](https://github.com/react-native-webview/react-native-webview/blob/master/docs/Contributing.md)
71
72### License
73
74MIT
75
76### Translations
77
78This readme is available in:
79
80- [Brazilian portuguese](docs/README.portuguese.md)
81- [French](docs/README.french.md)
82- [Italian](docs/README.italian.md)