I have just started react-native and trying to create first Hello, world screen but I'm getting below error
ReactNativeJS: ReferenceError: Can't find variable: View
This error is located at:
in Unknown
in RCTView
in RCTView
in c
below is my code for App.js
import React, {Fragment,Component} from 'react';
import HelloWorldApp from './components/HelloWorldApp';
import { BrowserRouter as Router, Route } from "react-router-dom"
const App = () => {
return (
<Router>
<div>
<Route exact path='/' component={HelloWorldApp} />
</div>
</Router>
);
};
export default App;
Below is my code for HelloWorldApp.js
import React, {Component} from 'react';
import {Text, View} from 'react-native';
export default class HelloWorldApp extends Component {
render() {
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<Text>Hello, world!</Text>
</View>
);
}
}
I have already import this import {Text, View} from 'react-native'; but still I'm getting error Can't find variable: View
Below are some links that i have already check but it didn't help me to solve my issue
UPDATE
I have tried this
Delete and re-install the node modules
Now I'm getting this error
ReactNativeJS: Error: Invariant failed
This error is located at:
in l
in f
in RCTView
in RCTView
in c
can anybody tell me what I'm missing
Can anybody help me to solve this issue
If need more information please do let me know. Thanks in advance. Your efforts will be appreciated.