Delete button

This commit is contained in:
Diego Mello 2020-04-24 08:56:55 -03:00
parent 4a2e4ef04e
commit fc9d75f78c
3 changed files with 21 additions and 8 deletions

View File

@ -7,7 +7,7 @@ import { themes } from '../../../constants/colors';
import Touch from '../../../utils/touch'; import Touch from '../../../utils/touch';
const Button = ({ const Button = ({
text, disabled, theme, onPress text, disabled, theme, onPress, del
}) => ( }) => (
<Touch <Touch
style={[styles.buttonCircle, { backgroundColor: themes[theme].backgroundColor, borderColor: themes[theme].borderColor }]} style={[styles.buttonCircle, { backgroundColor: themes[theme].backgroundColor, borderColor: themes[theme].borderColor }]}
@ -15,9 +15,19 @@ const Button = ({
theme={theme} theme={theme}
onPress={() => onPress && onPress(text)} onPress={() => onPress && onPress(text)}
> >
<Text style={[styles.text, { color: themes[theme].titleText }]}> {
{text} del
</Text> ? (
<Text style={[styles.deleteText, { color: themes[theme].titleText }]}>
del
</Text>
)
: (
<Text style={[styles.text, { color: themes[theme].titleText }]}>
{text}
</Text>
)
}
</Touch> </Touch>
); );
@ -25,6 +35,7 @@ Button.propTypes = {
text: PropTypes.string, text: PropTypes.string,
theme: PropTypes.string, theme: PropTypes.string,
disabled: PropTypes.bool, disabled: PropTypes.bool,
del: PropTypes.bool,
onPress: PropTypes.func onPress: PropTypes.func
}; };

View File

@ -107,7 +107,7 @@ const Base = forwardRef(({
<Button text='0' theme={theme} onPress={onPressNumber} /> <Button text='0' theme={theme} onPress={onPressNumber} />
</Col> </Col>
<Col style={styles.colButtonCircle}> <Col style={styles.colButtonCircle}>
<Button text='X' theme={theme} onPress={onPressDelete} /> <Button del theme={theme} onPress={onPressDelete} />
</Col> </Col>
</Row> </Row>
</Grid> </Grid>

View File

@ -6,8 +6,7 @@ export default StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center'
// width: '100%'
}, },
viewTitle: { viewTitle: {
flexDirection: 'column', flexDirection: 'column',
@ -50,12 +49,15 @@ export default StyleSheet.create({
fontSize: grid.unit * 2, fontSize: grid.unit * 2,
fontWeight: '200' fontWeight: '200'
}, },
deleteText: {
fontSize: grid.unit * 1.2,
fontWeight: '200'
},
buttonCircle: { buttonCircle: {
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
width: grid.unit * 4, width: grid.unit * 4,
height: grid.unit * 4, height: grid.unit * 4,
backgroundColor: 'rgb(242, 245, 251)',
borderRadius: grid.unit * 2, borderRadius: grid.unit * 2,
borderWidth: 1 borderWidth: 1
}, },