Warning Please use the fork of this component instead. To reduce the surface area of React Native,
<WebView/>
is going to be removed from the React Native core. For more information, please read .
一句话就是:使用 react-native-community/react-native-webview 替代。 要被从react-native core中删除了。
现在现在支持Android平台的onShouldStartLoadWithRequest方法了
##使用方式:
$ yarn add react-native-webview$ react-native link react-native-webview复制代码
##使用案例:
import React, { Component } from "react";import { StyleSheet, Text, View } from "react-native";import { WebView } from "react-native-webview";// ...class MyWebComponent extends Component { render() { return (console.log(e.nativeEvent.progress)} /> ); }}复制代码
如果出现如下报错:
Invariant Violation: requireNativeComponent: "RNCWKWebView" was not found in the UIManager
解决方案: ###1.将RNCWebView.xcodeproj添加到项目的Libraries中, 用Xcode打开项目,在librarie右键点击add Files to 项目中
###2.在Build Phases的Link Binary With Libraries中添加libRNCWebView.a文件