import React from "react";
import { View } from "react-native";
import ActionButton from "../../Buttons/ActionButton";

const renderEmptyView = () => {
  const emptyViewStyle: any = {
    width: 50,
    height: 50,
  };

  return <View style={emptyViewStyle} />;
};

type FloatingButtonProps = Testable & {
  onPress: () => void;
  screenStyles: any;
};

const BackButton = ({
  onPress,
  screenStyles,
  testID = "backButton",
}: FloatingButtonProps) => {
  const containerStyle: any = {};

  if (!onPress) {
    return renderEmptyView();
  }

  return (
    <ActionButton
      testID={`${testID}-actionButton`}
      onPress={onPress}
      buttonStyles={containerStyle}
      imageUrl={screenStyles.back_button_image}
    />
  );
};

export default BackButton;
