/**
 * React Native Full App (https://store.enappd.com/product/react-native-full-app)
 *
 * Copyright © 2019-present Enappd. All rights reserved.
 *
 * This source code is licensed as per the terms found in the
 * LICENSE.md file in the root directory of this source tree.
 */

import React from 'react';
import { Spinner, Button, Text } from 'native-base';
import styles from './style';

interface ActionButtonProps {
  onPress: () => void;
  disabled?: boolean;
  activityLoading: boolean;
  displayText: string;
}

const ActionButton = (props: ActionButtonProps) => (
  <Button
    full
    rounded
    warning
    style={styles.marginTop}
    onPress={props.onPress}
    disabled={props.disabled || props.activityLoading}
  >
    {!props.activityLoading && <Text> {props.displayText} </Text>}
    {props.activityLoading && <Spinner size="small" />}
  </Button>
);

export default ActionButton;
