NOTE: This is a customized fork of the upstream react-native-webview library. It follows latest upstream releases, and applies on top of them selected fixes and PRs, faster than the ages it takes to merge them into the upstream.
To use this fork remove the original react-native-webview
dependency from
your package.json
, then install the forked package as
npm install --save @dr.pogodin/react-native-webview
then replace react-native-webview
imports in your TypeScript code by
@dr.pogodin/react-native-webview
imports.
Current Differences from the Upstream:
-
Upstream issue #3014 / Upstream PR #3575 — Android: Accept the input focus only when a touch on WebView hits a focusable (text input) element inside the WebView's content.
-
Upstream issue #3289 / Upstream PR #3290 — Android: Trigger
onError
callback on asset loading errors. -
Upstream issue #3317 / Upstream PR #3318 — Android, iOS, macOS: Support of
window.print()
function. -
Upstream issue #3578 — iOS: Fixed loading of JS assets (reverts the change from the upstream v13.12.3 that led to the regression).
-
Scaffolding of Example App in the repo is reset to that used by creact-react-native-library.
-
Some dependencies are updated to their newer versions.
Integreat sponsored the effort to fix the upstream issue #3014 . |
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).
Many thanks to these companies for providing us with time to work on open source.
Please note that maintainers spend a lot of free time working on this too so feel free to sponsor them, it really makes a difference.
Windows and macOS are managed by Microsoft, notably:
- Alexander Sklar (Twitter @alexsklar) from React Native for Windows
- Chiara Mooney from React Native for Windows @ Microsoft
Shout-out to Jamon Holmgren from Infinite Red for helping a lot with the repo when he had more available time.
Maintaining 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.
Since WebView was extracted from the React Native core, nearly 500 pull requests have been merged.
Considering 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.
This project is compatible with iOS, Android, Windows and macOS.
This project supports both the old (paper) and the new architecture (fabric).
This project is compatible with expo.
Read our Getting Started Guide. If any step seems unclear, please create a pull request.
This project follows semantic versioning. We do not hesitate to release breaking changes but they will be in a major version.
Import the WebView
component from react-native-webview
and use it like so:
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { WebView } from 'react-native-webview';
// ...
const MyWebComponent = () => {
return <WebView source={{ uri: 'https://reactnative.dev/' }} style={{ flex: 1 }} />;
}
For more, read the API Reference and Guide. If you're interested in contributing, check out the Contributing Guide.
- If you're getting
Invariant Violation: Native component for "RNCWebView does not exist"
it likely means you forgot to runreact-native link
or there was some error with the linking process - If you encounter a build error during the task
:app:mergeDexRelease
, you need to enable multidex support inandroid/app/build.gradle
as discussed in this issue
Contributions are welcome, see Contributing.md
MIT
This readme is available in: