This is my first React Native project and I’m trying to learn, but I’m prevented from continuing because I keep receiving this error. This is a brand-new project created from the expo cli. As soon as I add the "Button" property I run into this error.
Here is my code:
import React from 'react';
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<Button title='Push Me'/>
<Text>Open up App.js to start working on your app!</Text>
<StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
I am using the following dependencies:
- "expo": "^49.0.3"
- "expo-status-bar": "~1.2.0",
- "react": "18.2.0",
- "react-native": "0.71.8"
Please let me know if i am missing any important information.
>Solution :
You have to import the Button as well:
import { StyleSheet, Text, View, Button } from 'react-native';
^
