30 lines
850 B
TypeScript
30 lines
850 B
TypeScript
import React from 'react';
|
|
import { TouchableOpacity, Text } from 'react-native';
|
|
import { useTheme } from '@theme';
|
|
import { getStyles } from './actionButton.styles';
|
|
import { ActionButtonProps } from './actionButton.props';
|
|
|
|
export const ActionButton: React.FC<ActionButtonProps> = ({
|
|
label,
|
|
onPress,
|
|
variant = 'primary',
|
|
loading = false,
|
|
disabled = false,
|
|
}) => {
|
|
const { theme: colors } = useTheme();
|
|
const styles = getStyles(colors);
|
|
|
|
const buttonStyle = variant === 'primary' ? styles.primaryButton : styles.secondaryButton;
|
|
const textStyle = variant === 'primary' ? styles.primaryButtonText : styles.secondaryButtonText;
|
|
|
|
return (
|
|
<TouchableOpacity
|
|
style={buttonStyle}
|
|
onPress={onPress}
|
|
disabled={loading || disabled}
|
|
>
|
|
<Text style={textStyle}>{label}</Text>
|
|
</TouchableOpacity>
|
|
);
|
|
};
|