I wrote my first code "Welcome" in app.js, Here is an example of a JavaScript file and its output. when we press the 'Pirate' button in console.log one message appears this functionality is added, inspired by #HiteshChoudhary Sir - React Native Mastery with 10 apps - https://www.youtube.com/playlist?list=PLRAV69dS1uWSjBBJ-egNNOd4mdblt1P4c
import React from 'react'
import { View, Text, SafeAreaView, Image, ScrollView, TouchableOpacity } from 'react-native'
function MyButton ({onPress, text}){
return(
<TouchableOpacity
onPress={onPress} style={styles.button}>
<Text style={styles.buttonText}>{text}</Text>
</TouchableOpacity>
);
}
function App() {
return (
<SafeAreaView>
{/* The SafeAreaView is used as a top level container to render content safely away from notches/status bars. */}
<ScrollView>
<View>
<Text style={styles.normalText }>
Welocme !!!
</Text>
<Image source={require('./assets/image/Luffy.png')} />
<MyButton
onPress={() => console.warn("Kashiprasad is Here")}
text="Pirate"
/>
</View>
</ScrollView>
</SafeAreaView>
);
}
const styles ={
button:{
backgroundColor:'yellow',
padding : 10,
borderRadius:5,
alignItems:'center',
marginVertical:10,
},
buttonText:{
color: 'white',
fontWeight:'bold'
},
normalText:{
fontSize:50,
backgroundColor:'skyblue',
padding : 10,
borderRadius:5,
alignItems:'center',
marginVertical:10,
fontWeight:'bold',
}
};
export default App;