Warning Please use the react-native-community/react-native-webview 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 The Slimmening proposal.
一句话就是:使用 react-native-community/react-native-webview 替代。
现在react-native-webview现在支持Android平台的onShouldStartLoadWithRequest方法了
##使用方式:
1 | $ yarn add react-native-webview |
##使用案例:
1 | import React, { Component } from "react"; |
如果出现如下报错:
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文件