28 lines
652 B
TypeScript
28 lines
652 B
TypeScript
import React from 'react';
|
|
import { TouchableOpacity, Text, ActivityIndicator } from 'react-native';
|
|
import { ButtonProps } from './button.props';
|
|
import { styles } from './button.styles';
|
|
|
|
export function Button({
|
|
title,
|
|
onPress,
|
|
style,
|
|
textStyle,
|
|
loading = false,
|
|
}: ButtonProps) {
|
|
return (
|
|
<TouchableOpacity
|
|
activeOpacity={0.8}
|
|
disabled={loading}
|
|
style={[styles.button, loading && styles.disabled, style]}
|
|
onPress={onPress}
|
|
>
|
|
{loading ? (
|
|
<ActivityIndicator color="#ffffff" />
|
|
) : (
|
|
<Text style={[styles.text, textStyle]}>{title}</Text>
|
|
)}
|
|
</TouchableOpacity>
|
|
);
|
|
}
|