import React, { PropsWithChildren } from 'react'; import { ActivityIndicator, StyleSheet, Text, TouchableHighlight, TouchableHighlightProps, View, ViewStyle, } from 'react-native'; import Colors from '../constants/Colors'; type Props = PropsWithChildren< TouchableHighlightProps & { loading?: boolean; title?: string; buttonStyle?: ViewStyle; } >; const Button = ({ disabled, loading, title, onPress, onPressIn, style, buttonStyle, children, }: Props) => ( {children || (loading ? ( ) : ( {title} ))} ); const styles = StyleSheet.create({ container: { alignItems: 'center', justifyContent: 'center', }, button: { alignItems: 'center', justifyContent: 'center', borderRadius: 3, paddingVertical: 8, paddingHorizontal: 12, backgroundColor: Colors.tintColor, }, disabledButton: { backgroundColor: Colors.disabled, }, label: { color: '#ffffff', fontWeight: '700', }, }); export default Button;