@exodus/react-native-webview

中文文档
11.26.1-exodus.42发布于 2026/11/02MITTypeScriptCommonJS近 30 天下载 1.1万

React Native WebView component for iOS, Android, macOS, and Windows

原始使用文档
文档目录10 节
  1. Core Maintainers - Sponsoring companies
  2. Platforms Supported
  3. Getting Started
  4. Versioning
  5. Usage
  6. Common issues
  7. Contributing
  8. Contributors
  9. License
  10. Translations

React Native WebView - a Modern, Cross-Platform WebView for React Native

star this repo PRs Welcome All Contributors Known Vulnerabilities NPM Version Lean Core Extracted

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).

Core Maintainers - Sponsoring companies

This project is a fork of https://github.com/react-native-webview/react-native-webview. Please refer to that repository for full credits.

Platforms Supported

  • iOS
  • Android
  • macOS
  • Windows
  • Expo (Android, iOS)

Getting Started

Read our Getting Started Guide. If any step seems unclear, please create a detailed issue.

Versioning

This project follows semantic versioning. We do not hesitate to release breaking changes but they will be in a major version.

Breaking History:

Current Version: version

  • 11.0.0 - Android setSupportMultipleWindows.
  • 10.0.0 - Android Gradle plugin is only required when opening the project stand-alone
  • 9.0.0 - props updates to injectedJavaScript are no longer immutable.
  • 8.0.0 - onNavigationStateChange now triggers with hash url changes
  • 7.0.1 - Removed UIWebView
  • 6.0.2 - Update to AndroidX. Make sure to enable it in your project's android/gradle.properties. See Getting Started Guide.
  • 5.0.1 - Refactored the old postMessage implementation for communication from webview to native.
  • 4.0.0 - Added cache (enabled by default).
  • 3.0.0 - WKWebview: Add shared process pool so cookies and localStorage are shared across webviews in iOS (enabled by default).
  • 2.0.0 - First release this is a replica of the core webview component

Upcoming:

  • this.webView.postMessage() removal (never documented and less flexible than injectJavascript) -> how to migrate
  • Kotlin rewrite
  • Maybe Swift rewrite

Usage

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';

// ...
class MyWebComponent extends Component {
  render() {
    return <WebView source={{ uri: 'https://reactnative.dev/' }} />;
  }
}

For more, read the API Reference and Guide. If you're interested in contributing, check out the Contributing Guide.

Common issues

  • 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
  • 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

Contributing

See Contributing.md

Contributors

This project is a fork of https://github.com/react-native-webview/react-native-webview. Please refer to that repository for full credits.

License

MIT

Translations

This readme is available in:

版本与发布记录

@exodus/react-native-webview 共发布 53 个版本,首次发布于 2020/05/19;过去 12 个月发布了 13 个版本。

版本发布日期距今
11.26.1-exodus.42latest2026/11/0211 天前
11.26.1-exodus.412026/11/0112 天前
11.26.1-exodus.402026/11/0113 天前
11.26.1-exodus.392026/08/143 个月前
13.16.0-exodus.72026/06/234 个月前
13.16.0-exodus.62026/06/234 个月前

关于 @exodus/react-native-webview 的常见问题

@exodus/react-native-webview 是什么?

React Native WebView component for iOS, Android, macOS, and Windows

如何安装 @exodus/react-native-webview?

在项目目录运行 npm install @exodus/react-native-webview,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(*)、react-native(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@exodus/react-native-webview 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@exodus/react-native-webview 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@exodus/react-native-webview 可以商用吗?

@exodus/react-native-webview 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@exodus/react-native-webview 的下载量有多少?

根据 npm 官方下载统计,@exodus/react-native-webview 在 2026/10/14 – 2026/11/12 这 30 天内被下载 11,458 次,日均约 382 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@exodus/react-native-webview 还在维护吗?

最新版本 11.26.1-exodus.42 发布于 2026/11/02(11 天前);至今共发布 53 个版本,其中过去 12 个月发布了 13 个;首次发布于 2020/05/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。