Extract navigation arrow and give it more padding

This commit is contained in:
Julia Friesel
2018-11-16 16:01:53 +01:00
parent d9123584c3
commit 3aacff6f83
5 changed files with 54 additions and 33 deletions
+31
View File
@@ -0,0 +1,31 @@
import React from 'react'
import { TouchableOpacity } from 'react-native'
import styles, { iconStyles } from '../../styles'
import Icon from 'react-native-vector-icons/Entypo'
export default function NavigationArrow(props) {
const iconName = {
left: 'chevron-thin-left',
right: 'chevron-thin-right'
}[props.direction]
let pressHandler
if (props.goBack) {
pressHandler = () => props.goBack()
} else {
pressHandler = () => {
const target = props.direction === 'left' ? 'before' : 'after'
props.goToCycleDay(target)
}
}
return (
<TouchableOpacity
style={styles.navigationArrow}
onPress={pressHandler}
>
<Icon
name={iconName}
{...iconStyles.navigationArrow}
/>
</TouchableOpacity>
)
}