Last active
September 19, 2020 08:59
-
-
Save khwilo/56c891af62950c159531a05929f9c9d2 to your computer and use it in GitHub Desktop.
Tip Calculator SplitCount component file
This file contains hidden or 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 from 'react'; | |
| import { MaterialIcons } from '@expo/vector-icons'; | |
| import { StyleSheet, Text, View } from 'react-native'; | |
| const styles = StyleSheet.create({ | |
| textHeader: { | |
| fontSize: 18, | |
| color: '#ffffff', | |
| fontWeight: '700', | |
| letterSpacing: 1.5, | |
| }, | |
| tipSplitContainer: { | |
| flexDirection: 'row', | |
| justifyContent: 'space-between', | |
| alignItems: 'center', | |
| }, | |
| icon: { | |
| fontWeight: '400', | |
| backgroundColor: '#deddf2', | |
| borderRadius: 100, | |
| }, | |
| splitInput: { | |
| paddingHorizontal: 10, | |
| fontSize: 30, | |
| color: '#ffffff', | |
| }, | |
| }); | |
| const SplitCount = ({ split, handleSplitAdd, handleSplitRemove }) => { | |
| return ( | |
| <View> | |
| <Text style={styles.textHeader}>Split</Text> | |
| <View style={styles.tipSplitContainer}> | |
| <MaterialIcons | |
| style={styles.icon} | |
| name='add' | |
| size={24} | |
| onPress={handleSplitAdd} | |
| /> | |
| <Text style={styles.splitInput}>{split}</Text> | |
| <MaterialIcons | |
| style={styles.icon} | |
| name='remove' | |
| size={24} | |
| onPress={handleSplitRemove} | |
| disabled={split < 2} | |
| /> | |
| </View> | |
| </View> | |
| ); | |
| }; | |
| export default SplitCount; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment