diff --git a/src/theme/NativeIdealImage.tsx b/src/theme/NativeIdealImage.tsx index 39fda33..f8a883b 100644 --- a/src/theme/NativeIdealImage.tsx +++ b/src/theme/NativeIdealImage.tsx @@ -5,10 +5,11 @@ import type { NativeIdealImageProps } from '../index.js' import './NativeIdealImage.css' export default function NativeIdealImage(props: NativeIdealImageProps): JSX.Element { - const { img, width, height, sizes, loading, swapOnLoad, ...propsRest } = props + const { img, swapOnLoad, src, width, height, sizes, loading, ...propsRest } = props - const formats = typeof img === 'object' && 'formats' in img ? img.formats : [] - const lqip = typeof img === 'object' && 'lqip' in img ? img.lqip : '' + const enabled = typeof img === 'object' && 'formats' in img + const formats = enabled ? img.formats : [] + const lqip = enabled ? img.lqip : undefined const singleImage = formats[0]?.srcSet.length === 1 ? formats[0] : undefined @@ -40,11 +41,11 @@ export default function NativeIdealImage(props: NativeIdealImageProps): JSX.Elem ))}