import React from 'react';
import { Image } from 'react-native';
import ApiConstants from '../api/ApiConstants.js';

export interface Props {
  filename: string;
  width: number;
  height: number;
  style?: Record<string, unknown>;
}

const ImageComponent: React.FC<Props> = (props) => {
  // console.log(ApiConstants.BASE_URL + 'api/' + props.filename);
  return (
    <Image
      source={{ uri: ApiConstants.BASE_URL + 'api/image/' + props.filename }}
      style={{ width: props.width, height: props.height, ...props.style }}
    />
  );
};
export default ImageComponent;
