I am trying to learn how to use React Native hooks and create reusable components once I call GetPlayer, nothing appears on my screen when running my code and I am not getting any exceptions in my Console.
Am I calling the GetPlayer component correctly or is there something I am missing? thanks
App.js File below
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
import GetPlayer from './GetPlayer';
export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<GetPlayer />
<StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
GetPlayer.js file
import { View } from "react-native-web"
export default function GetPlayer(){
return (
<View style={styles.container}>
<Text>Test </Text>
</View>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
Image of folder
3
Answers
In GetPlayer.js file try below imports and Text component is also not imported
Try making changes to the
flex:1
style in App.js and I think you don’t need to applyflex:1
in GetPlayer.js also.