import * as React from "react";
import { View, ViewStyle } from "react-native";

import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";

type Props = {
  style: ViewStyle;
  label?: string;
  children: React.ReactChild;
  backgroundColor?: string;
};

export const CollapsibleTextContainer = ({
  children,
  style,
  label,
  backgroundColor,
}: Props) => {
  if (isNilOrEmpty(label)) {
    return null;
  }

  return <View style={{ ...style, backgroundColor }}>{children}</View>;
};
