Skip to content
This repository has been archived by the owner on Jun 27, 2022. It is now read-only.

Commit

Permalink
Changes for style-UdaciSteppers
Browse files Browse the repository at this point in the history
  • Loading branch information
tylermcginnis committed Aug 30, 2017
1 parent 31c3e56 commit 2c0d0b9
Showing 1 changed file with 56 additions and 14 deletions.
70 changes: 56 additions & 14 deletions components/UdaciSteppers.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,64 @@
import React from 'react'
import { View, TouchableOpacity, Text } from 'react-native'
import { Platform, View, TouchableOpacity, Text, StyleSheet } from 'react-native'
import { FontAwesome, Entypo } from '@expo/vector-icons'
import { purple, gray, white } from '../utils/colors'

export default function UdaciSteppers ({ max, unit, step, value, onIncrement, onDecrement }) {
return (
<View>
<View>
<TouchableOpacity onPress={onDecrement}>
<FontAwesome name='minus' size={30} color={'black'} />
</TouchableOpacity>
<TouchableOpacity onPress={onIncrement}>
<FontAwesome name='plus' size={30} color={'black'} />
</TouchableOpacity>
</View>
<View>
<Text>{value}</Text>
<Text>{unit}</Text>
<View style={[styles.row, {justifyContent: 'space-between'}]}>

This comment has been minimized.

Copy link
@deboradurek

deboradurek Jun 24, 2021

Why add justifyContent: 'space-between' separately, and not include it in the "row" styles?
I testes it out and I couldn't catch the difference if any...

{Platform.OS === 'ios'
? <View style={{flexDirection: 'row'}}>
<TouchableOpacity
style={[styles.iosBtn, {borderTopRightRadius: 0, borderBottomRightRadius: 0}]}
onPress={onDecrement}>
<Entypo name='minus' size={30} color={purple} />
</TouchableOpacity>
<TouchableOpacity
style={[styles.iosBtn, {borderTopLeftRadius: 0, borderBottomLeftRadius: 0, borderLeftWidth: 0}]}
onPress={onIncrement}>
<Entypo name='plus' size={30} color={purple} />
</TouchableOpacity>
</View>
: <View style={{flexDirection: 'row'}}>
<TouchableOpacity style={styles.androidBtn} onPress={onDecrement}>
<FontAwesome name='minus' size={30} color={white} />
</TouchableOpacity>
<TouchableOpacity style={styles.androidBtn} onPress={onIncrement}>
<FontAwesome name='plus' size={30} color={white} />
</TouchableOpacity>
</View>}
<View style={styles.metricCounter}>
<Text style={{fontSize: 24, textAlign: 'center'}}>{value}</Text>
<Text style={{fontSize: 18, color: gray}}>{unit}</Text>
</View>
</View>
)
}
}

const styles = StyleSheet.create({
row: {
flexDirection: 'row',
flex: 1,
alignItems: 'center',
},
androidBtn: {
margin: 5,
backgroundColor: purple,
padding: 10,
borderRadius: 2,
},
iosBtn: {
backgroundColor: white,
borderColor: purple,
borderWidth: 1,
borderRadius: 3,
padding: 5,
paddingLeft: 25,
paddingRight: 25,
},
metricCounter: {
width: 85,
justifyContent: 'center',
alignItems: 'center'
},
})

0 comments on commit 2c0d0b9

Please sign in to comment.