You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
887 B
37 lines
887 B
7 years ago
|
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>
|
||
|
);
|
||
|
}
|
||
|
}
|