From 5a66d0901cacbb8aac3aee6948a04c1f54f008cb Mon Sep 17 00:00:00 2001 From: Matt Perry Date: Mon, 2 Jan 2023 11:54:26 +0100 Subject: [PATCH] Adding default animation type --- .../src/animation/legacy-popmotion/index.ts | 3 ++- .../src/motion/__tests__/animate-prop.test.tsx | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/framer-motion/src/animation/legacy-popmotion/index.ts b/packages/framer-motion/src/animation/legacy-popmotion/index.ts index 948c82bf65..4538f7df8f 100644 --- a/packages/framer-motion/src/animation/legacy-popmotion/index.ts +++ b/packages/framer-motion/src/animation/legacy-popmotion/index.ts @@ -73,7 +73,8 @@ export function animate({ let interpolateFromNumber: (t: number) => V - const animator = types[keyframes.length > 2 ? "keyframes" : type] + const animator = + types[keyframes.length > 2 ? "keyframes" : type] || keyframeAnimation const origin = keyframes[0] const target = keyframes[keyframes.length - 1] diff --git a/packages/framer-motion/src/motion/__tests__/animate-prop.test.tsx b/packages/framer-motion/src/motion/__tests__/animate-prop.test.tsx index 53506b16a2..9e3bf3007d 100644 --- a/packages/framer-motion/src/motion/__tests__/animate-prop.test.tsx +++ b/packages/framer-motion/src/motion/__tests__/animate-prop.test.tsx @@ -676,4 +676,17 @@ describe("animate prop as object", () => { return expect(testFn).toHaveBeenCalled() }) + + test("doesn't error when provided unknown animation type", async () => { + const Component = () => { + return ( + + ) + } + const { rerender } = render() + rerender() + }) })