I am trying to add React-Native Webview in my existing iOS app, but getting issue Native Module cannot be null. I have tried lot of solutions from online community but yet not fixed the issue.
'use strict';
import React, { Component } from 'react';
import { StyleSheet, View, ScrollView, RefreshControl, WebView, Text} from 'react-native';
export default class Dashboard extends Component {
render() {
return (
<WebView
originWhitelist={['*']}
source={{ html: '<h1>Hello world</h1>' }}
/>
);
}
}
Error:
Unhandled JS Exception: Requiring module "node_modules/react-native/Libraries/Components/WebView/WebView.ios.js", which threw an exception: Invariant Violation: Native module cannot be Unhandled JS Exception: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.