Skip to content

🎥 Make videos programmatically with React

don't crash if passing a .gif to an <Img>

Jonny Burgercd3a54333d50
diff --git a/packages/core/src/Img.tsx b/packages/core/src/Img.tsx
index 3345d49c95..97372a91b7 100644
--- a/packages/core/src/Img.tsx
+++ b/packages/core/src/Img.tsx
@@ -16,12 +16,6 @@ const ImgRefForwarding: React.ForwardRefRenderFunction<
> = ({onError, ...props}, ref) => {
const imageRef = useRef<HTMLImageElement>(null);
- if (props.src?.endsWith('.gif')) {
- throw new TypeError(
- 'The <Img> component does not support GIFs. Use the <Gif> instead: https://remotion.dev/docs/gif'
- );
- }
-
useImperativeHandle(ref, () => {
return imageRef.current as HTMLImageElement;
});
diff --git a/packages/eslint-plugin/src/rules/use-gif-component.ts b/packages/eslint-plugin/src/rules/use-gif-component.ts
index c3e0818225..699afa2ec1 100644
--- a/packages/eslint-plugin/src/rules/use-gif-component.ts
+++ b/packages/eslint-plugin/src/rules/use-gif-component.ts
@@ -9,8 +9,9 @@ type Options = [];
type MessageIds = "UseGifComponent";
const UseGifComponent = [
- "Use the <Gif> component for animated GIFs instead.",
- "See: https://www.remotion.dev/docs/gif",
+ "Use the <Gif> component animated GIFs.",
+ "See: https://www.remotion.dev/docs/gif.",
+ "Ignore this message if this is a non-animated GIF.",
].join("\n");
export default createRule<Options, MessageIds>({