Created
February 5, 2018 16:44
-
-
Save Chiamaka/1ec55db9f0704921549852bc00bcb205 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PureComponent } from 'react'; | |
import { View, Animated } from 'react-native'; | |
import AddButton from './AddButton'; | |
import MinusButton from './MinusButton'; | |
import Counter from './Counter'; | |
export default class CompleteComponent extends PureComponent { | |
state = { | |
counter: 1 | |
}; | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Counter counter={this.state.counter}/> | |
<MinusButton /> | |
<AddButton /> | |
</View> | |
); | |
} | |
} | |
const styles = { | |
container: { | |
flex: 1, | |
flexDirection: 'row', | |
justifyContent: 'center', | |
alignItems: 'center', | |
backgroundColor: '#F5FCFF' | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PureComponent } from 'react'; | |
import { View, Animated, Text } from 'react-native'; | |
import PropTypes from 'prop-types'; | |
export default class Counter extends PureComponent { | |
render() { | |
return ( | |
<Animated.View style={[styles.counterDisplayStyle]}> | |
<Animated.Text style={[styles.textStyle]}> | |
{this.props.counter} | |
</Animated.Text> | |
</Animated.View> | |
); | |
} | |
} | |
Counter.propTypes = { | |
counter: PropTypes.number | |
}; | |
const styles = { | |
counterDisplayStyle: { | |
backgroundColor: 'rgb(240,240,240)', | |
borderRadius: 30, | |
borderColor: 'rgb(240,240,240)', | |
borderWidth: 1, | |
width: 60, | |
height: 60, | |
justifyContent: 'center', | |
alignItems: 'center' | |
}, | |
textStyle: { | |
fontSize: 28 | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment