Webview is not loading uri, showing only white page

  1. SDK Version: 35.0.0(expo)
  2. Platforms(Android/iOS/web/all): all

I am using expo to build my react-native project but got this error:
The error is: Invariant Violation: Native component for “RNCWebView does not exist”
As I know, there are two options for displaying web contents

  1. import {WebView} from “react-native-webview”
  2. import {WebView} from “react-native”
    I am using expo for my react-native project
    So, there are some bugs/errors I got
    For the 1st option, I got error–> Invariant Violation: Native component for “RNCWebView does not exist”
    For the 2nd option, I got no error but instead of showing url, it shows me white page which shows nothing
    I tried many solutions from GitHub and StackOverflow but doesn’t work
    Any new idea?

The following works for me. Does it work for you? If this does not work for you, perhaps it would help for you to post your code.

Hi Thanks, I tried many things before including your’s, but now magic happened and it works

1 Like

I’m glad it’s working for you. By the way, I got this straight from the docs:

https://docs.expo.io/versions/v35.0.0/sdk/webview/#usage

There’s just one thing to be aware of: There are entries for WebView under both the SDK and the React Native sections of the menu. The “React Native” version is about the old import { WebView } from 'react-native'; whereas the one under “SDK” is the new import { WebView } from 'react-native-webview';

So if you find that there are entries under both the SDK section and the React Native section you should generally prefer the SDK entry.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.