React Native Button
App Name: Test
Component Name: App.js
---------------------------------------------------------------------------------------------
import React, { Component } from 'react';
import {
StyleSheet,
View,
Image,
Text,
Platform,
Alert,
Button
} from 'react-native';
class App extends Component {
onPressbtn() {
Alert.alert('Welcome To React Native King')
}
onPressbtn2() {
Alert.alert('Welcome To React Native King 2')
}
render() {
return (
<View style={styles.container}>
<View style={styles.btnContainer}>
<Button
onPress={this.onPressbtn}
title="Press Me"
/>
</View>
<View style={styles.btnContainer}>
<Button
onPress={this.onPressbtn}
title="Press Me"
color="red"
/>
</View>
<View style={styles.btnContainer2}>
<Button
onPress={this.onPressbtn2}
title="Ok"
color="green"
/>
</View>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
},
btnContainer: {
margin: 15,
},
btnContainer2: {
width: 50,
justifyContent: 'center',
borderWidth: 1,
borderColor: 'red'
}
})
export default App;
Comments
Post a Comment