Initial commit from boilerplate
This commit is contained in:
36
app/components/counter.js
Normal file
36
app/components/counter.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import React, {Component} from 'react';
|
||||
import {StyleSheet, View, Text, TouchableOpacity} from 'react-native';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
button: {
|
||||
width: 100,
|
||||
height: 30,
|
||||
padding: 10,
|
||||
backgroundColor: 'lightgray',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
margin: 3
|
||||
}
|
||||
});
|
||||
|
||||
export default class Counter extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { counter, increment, decrement } = this.props;
|
||||
|
||||
return (
|
||||
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center' }}>
|
||||
<Text>{counter}</Text>
|
||||
<TouchableOpacity onPress={increment} style={styles.button}>
|
||||
<Text>up</Text>
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity onPress={decrement} style={styles.button}>
|
||||
<Text>down</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user