Sky*_*thi 9 react-native react-native-webview
朋友你好,我在将 react-native-webview 链接到我的项目后收到此错误
Invariant Violation: requireNativeComponent: "RNCWebView" was not found in the UIManager.
This error is located at:
in RNCWebView (at WebView.android.js:250)
in RCTView (at WebView.android.js:253)
in WebView (at App.js:7)
in App (at renderApplication.js:45)
in RCTView (at AppContainer.js:109)
in RCTView (at AppContainer.js:135)
in AppContainer (at renderApplication.js:39)
Run Code Online (Sandbox Code Playgroud)
还有我的代码
import React, { Component } from 'react';
import { WebView } from 'react-native-webview';
export default class App extends Component {
render() {
return (
<WebView
originWhitelist={['*']}
source={{ html: '<h1>Hello world</h1>' }}
/>
);
}
}
Run Code Online (Sandbox Code Playgroud)
跑 react-native link react-native-webview
检查:https : //github.com/react-native-community/react-native-webview/issues/140
使用 React Native 0.60+,无需向 podfile 添加任何内容。再试一次cd ios && pod install
如果没有帮助,请尝试重新启动模拟器并重建应用程序。重新启动 Xcode 也是一个好主意。
尝试这些步骤。
| 归档时间: |
|
| 查看次数: |
18467 次 |
| 最近记录: |