easier ui handling

This commit is contained in:
moist-webDev 2023-06-06 00:17:25 -04:00
parent 4a1175ed21
commit 3e30ee41cf
1 changed files with 9 additions and 4 deletions

View File

@ -1,22 +1,27 @@
import { StyleSheet, Text, View} from 'react-native'; import { StyleSheet, Text, TouchableOpacity} from 'react-native';
export default function Button({ title='', theme={}, onPress, style={} }:any){ export default function Button({ title='', theme={}, onPress, style={} }:any){
return ( return (
<Text onPress={onPress} style={{...cstyle(theme).button, ...style}}>{title}</Text> <TouchableOpacity onPress={onPress} style={{...cstyle(theme).button, ...style}}>
<Text style={cstyle(theme).text}>{title}</Text>
</TouchableOpacity>
) )
} }
const cstyle = (theme:any) => { const cstyle = (theme:any) => {
return StyleSheet.create({ return StyleSheet.create({
container: {
},
button: { button: {
backgroundColor: theme.primary, backgroundColor: theme.primary,
padding: 10, padding: 10,
alignContent: 'center', alignContent: 'center',
textAlign: 'center',
justifyContent: 'center',
color: theme.text, color: theme.text,
margin: 10, margin: 10,
borderRadius: 5, borderRadius: 5,
}, },
text: {
color: theme.text,
},
}); });
} }