Don't render delete icon, instead of just setting it invisible

This commit is contained in:
Julia Friesel
2019-05-21 17:32:51 +02:00
parent 4b469f2f49
commit cef2e850d7
3 changed files with 24 additions and 20 deletions
+5 -1
View File
@@ -8,6 +8,10 @@ export default function NavigationArrow(props) {
left: 'chevron-thin-left', left: 'chevron-thin-left',
right: 'chevron-thin-right' right: 'chevron-thin-right'
}[props.direction] }[props.direction]
const iconPosition = {
left: 'navigationArrowLeft',
right: 'navigationArrowRight'
}[props.direction]
let pressHandler let pressHandler
if (props.goBack) { if (props.goBack) {
pressHandler = () => props.goBack() pressHandler = () => props.goBack()
@@ -19,7 +23,7 @@ export default function NavigationArrow(props) {
} }
return ( return (
<TouchableOpacity <TouchableOpacity
style={styles.navigationArrow} style={[styles.navigationArrow, styles[iconPosition]]}
onPress={pressHandler} onPress={pressHandler}
> >
<Icon <Icon
+2 -2
View File
@@ -30,19 +30,19 @@ export default function SymptomViewHeader(props) {
{formatDate(props.date)} {formatDate(props.date)}
</Text> </Text>
</View > </View >
{ props.deleteIconActive &&
<TouchableOpacity <TouchableOpacity
onPress={props.deleteEntry} onPress={props.deleteEntry}
style={[ style={[
styles.headerDeleteButton, styles.headerDeleteButton,
{opacity: props.deleteIconActive ? 1 : 0}
]} ]}
disabled={!props.deleteIconActive}
> >
<Icon <Icon
name="delete" name="delete"
{...iconStyles.symptomHeaderIcons} {...iconStyles.symptomHeaderIcons}
/> />
</TouchableOpacity> </TouchableOpacity>
}
</View> </View>
) )
+6 -6
View File
@@ -234,13 +234,12 @@ export default StyleSheet.create({
justifyContent: 'center', justifyContent: 'center',
height: 80 height: 80
}, },
headerCycleDay: {
flexDirection: 'row',
justifyContent: 'space-between',
},
navigationArrow: { navigationArrow: {
padding: 20 padding: 20,
position: 'absolute'
}, },
navigationArrowLeft: { left: 0 },
navigationArrowRight: { right: 0 },
menu: { menu: {
backgroundColor: primaryColor, backgroundColor: primaryColor,
alignItems: 'center', alignItems: 'center',
@@ -453,7 +452,8 @@ export default StyleSheet.create({
headerDeleteButton: { headerDeleteButton: {
paddingHorizontal: 20, paddingHorizontal: 20,
paddingVertical: 20, paddingVertical: 20,
alignItems: 'flex-end' position: 'absolute',
right: 0
}, },
infoButtonSymptomView: { infoButtonSymptomView: {
position: 'absolute', position: 'absolute',