import React from "react";
import { isVideoPreviewEnabled } from "@applicaster/zapp-react-native-ui-components/Components/MasterCell/utils";
import { LiveImage } from "../LiveImage";
import PureImage from "../Image";
import { useIsScreenActive } from "@applicaster/zapp-react-native-utils/reactHooks";

type Props = {
  enable_video_preview: boolean;
  player_screen_id: string;
};

export const ImageContainer = (props: Props) => {
  const isActive = useIsScreenActive();

  const Component =
    isVideoPreviewEnabled(props) && isActive ? LiveImage : PureImage;

  return <Component {...props} />;
};
