meditmoblibrary
Version:
MedIT ADF Mobile Library
44 lines (40 loc) • 1.14 kB
JavaScript
import React from 'react'
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'
import COLORS from 'meditmoblibrary/src/constants/colors'
import Icon from 'react-native-vector-icons/FontAwesome'
const CButton = ({ title, onPress, color = COLORS.COLOR.PRIMARY, disabled = false, icon }) => {
return (
<TouchableOpacity
style={{
...styles.container,
backgroundColor: disabled ? COLORS.COLOR.SECONDARY : color,
}}
onPress={onPress}
disabled={disabled}
>
{icon && (
<View style={{ padding: 10, position: 'absolute', left: 5 }}>
<Icon name={icon} size={16} color='#ffff' />
</View>
)}
<Text style={styles.buttonText}>{title}</Text>
</TouchableOpacity>
)
}
export default CButton
const styles = StyleSheet.create({
container: {
borderRadius: 5,
width: '100%',
height: 45,
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row',
},
buttonText: {
color: 'white',
fontSize: 16,
fontWeight: 'bold',
textAlign: 'center',
},
})