Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invariant Violation: requireNativeComponent: "RNCWebView" was not found in the UIManager

Hello friends i got this error after linking react-native-webview to my project

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)

And there is my code

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>' }}
      />
    );
  }
}

Error Image in my android

like image 557
Sky Sakthi Avatar asked May 16 '20 05:05

Sky Sakthi


2 Answers

With React Native 0.60+, no need to add anything to the podfile. Try again cd ios && pod install

If it doesn't help, try restarting the simulator and rebuilding the app. Restarting Xcode is also a good idea.

You could optionally clean the build Folder in XCode enter image description here

like image 150
Raphael Pinel Avatar answered Sep 24 '22 08:09

Raphael Pinel


Try these steps.

  1. Delete pods folder and podfile.lock
  2. npm uninstall react-native-webview
  3. npm i react-native-webview
  4. cd ios
  5. pod install
  6. (npx) react-native run-ios
  7. Reset cache
like image 44
Ruban Dharmaraj Avatar answered Sep 21 '22 08:09

Ruban Dharmaraj