0

I tried adding a web view to my app but I'm getting this error:

../node_modules/react-native-webview/lib/WebView.js
Module not found: Can't resolve 'react-native-web/dist/exports/View' in 'C:\Users\Nikola\node_modules\react-native-webview\lib'

This is my minimal code:

import { WebView } from 'react-native-webview';

export default function App() {

  return (
     <SafeAreaView style={styles.container}>
         <WebView source={{uri:'https://google.com'}} />
         <StatusBar style="auto" />
    </SafeAreaView>
  );
}

I really don't know what I'm doing wrong? I used the command npm install react-native-webview but still this error...

3
  • try to use npm i react-native-webview --save and then run yarn, and rebuild the app Commented Oct 4, 2021 at 20:50
  • I did it and nothing changed, could you be little more precise? Commented Oct 4, 2021 at 21:49
  • when u use --save when installing a package, it will be saved, also try to use --force, this can be done when installing the package Commented Oct 4, 2021 at 22:02

1 Answer 1

1

I was getting the same error with the latest version of react-native-webview.

Downgrading the version to [email protected] solved my issue.

I used yarn add [email protected], after uninstalling the previous version.

Sign up to request clarification or add additional context in comments.

1 Comment

actually my error gone .. but webview not available

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.