App
that returns a View
containing a Text
component and a Button
component.handlePress
function that gets called when the button is pressed. For now, it just logs a message to the console.import React from 'react';
import { View, Text, Button, StyleSheet } from 'react-native';
const App = () => {
const handlePress = () => {
console.log('Button pressed!');
};
return (
<View style={styles.container}>
<Text style={styles.text}>Hello, React Native!</Text>
<Button title="Press Me" onPress={handlePress} />
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fff',
},
text: {
fontSize: 24,
marginBottom: 20,
},
});
export default App;
© www.thecoderjob.com. All Rights Reserved. Designed by HTML Codex