added touchables to the buttons

This commit is contained in:
Niklas 2021-01-22 16:19:44 +01:00
parent 6bff17f226
commit 6501c01525

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import {StyleSheet, Text, View} from 'react-native'; import {StyleSheet, Text, TouchableHighlight, View} from 'react-native';
interface Props { interface Props {
text: string; text: string;
@ -9,7 +9,13 @@ export default function DeckButton(props: Props) {
return ( return (
<> <>
<View style={style.view}> <View style={style.view}>
<Text style={style.text}>{props.text}</Text> <TouchableHighlight
style={style.touchable}
underlayColor={'#f0f'}
onPress={() => console.log(props.text)}
onLongPress={() => console.log('long press')}>
<Text style={style.text}>{props.text}</Text>
</TouchableHighlight>
</View> </View>
</> </>
); );
@ -20,9 +26,16 @@ const style = StyleSheet.create({
backgroundColor: '#ff4000', backgroundColor: '#ff4000',
flexBasis: (1 / 3) * 100 + '%', flexBasis: (1 / 3) * 100 + '%',
height: 80, height: 80,
borderColor: '#94f713',
borderWidth: 1,
flex: 1,
},
touchable: {
width: '100%',
height: '100%',
}, },
text: { text: {
backgroundColor: '#ffbf00', //backgroundColor: '#ffbf00',
textAlign: 'center', textAlign: 'center',
}, },
}); });