/* * File: Button.tsx * Description: A reusable button component with optional loading state. * Design & Developed by Tech4Biz Solutions * Copyright (c) Spurrin Innovations. All rights reserved. */ import React from 'react'; import { TouchableOpacity, Text, StyleSheet, ActivityIndicator } from 'react-native'; // Import ActivityIndicator import { Colors, Spacing, Typography, BorderRadius } from '../../theme'; interface ButtonProps { title: string; onPress: () => void; style?: object; textStyle?: object; disabled?: boolean; loading?: boolean; // Add loading prop } const Button: React.FC = ({ title, onPress, style, textStyle, disabled, loading, // Destructure loading prop }) => { return ( {loading ? ( ) : ( {title} )} ); }; const styles = StyleSheet.create({ button: { backgroundColor: Colors.primary, paddingVertical: Spacing.lg, paddingHorizontal: Spacing.lg, borderRadius: BorderRadius.xl, alignItems: 'center', justifyContent: 'center', }, text: { color: Colors.background, fontSize: Typography.fontSize.sm, fontFamily: Typography.fontFamily.bold, }, disabled: { backgroundColor: Colors.primary, }, }); export default Button;