Function useImageStyle

Custom hook that returns the image style based on the provided props.

This hook takes optional image style properties and returns the appropriate image style. If the input is undefined or empty, it returns an empty object. It also merges with any new styles provided.

const style = useImageStyle({ width: 100 }, { height: 200 });
// style will be { width: 100, height: 200 }

const style = useImageStyle({ width: 100 });
// style will be { width: 100 }

const style = useImageStyle();
// style will be {}
  • Parameters

    • OptionalimageStyleProps: ImageStyle

      The initial style props for the image, which can be a single style object.

    • OptionalnewStyles: ImageStyle

      Additional style props to be merged with the initial styles, which can be a single style object.

    Returns ImageStyle

    The merged image style object.