Add press handlers to buttons

This commit is contained in:
Julia Friesel
2018-12-23 16:46:10 +01:00
parent 000e1b63c7
commit 2c1b856234
4 changed files with 37 additions and 18 deletions
+11 -9
View File
@@ -1,18 +1,20 @@
import React from 'react'
import { View } from 'react-native'
import { TouchableOpacity } from 'react-native'
import AppText from './app-text'
import styles from '../styles'
export default function Button({ backgroundColor, style, children }) {
export default function Button(props) {
return (
<View style={[
styles.button,
style,
{backgroundColor}
]}>
<TouchableOpacity
onPress={props.onPress}
style={[
styles.button,
props.style,
{backgroundColor: props.backgroundColor}
]}>
<AppText style={styles.homeButtonText}>
{children}
{props.children}
</AppText>
</View>
</TouchableOpacity>
)
}