Skip to content

Commit 4034bb3

Browse files
Merge pull request #2138 from framer/fix/border
Use `0` string values to template numerical values
2 parents 13f3a51 + 5eb40c4 commit 4034bb3

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

packages/framer-motion/src/animation/utils/__tests__/keyframes.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,19 @@ describe("getKeyframes", () => {
137137
)
138138
expect(e).toEqual(["0px", "50px"])
139139
})
140+
141+
test("Makes 0 motion value animatable to string", () => {
142+
const keyframes = getKeyframes(motionValue(0), "transform", "0%", {})
143+
expect(keyframes).toEqual(["0%", "0%"])
144+
})
145+
146+
test("Makes 0 keyframe animatable to string", () => {
147+
const keyframes = getKeyframes(
148+
motionValue(0),
149+
"transform",
150+
[0, "0%"],
151+
{}
152+
)
153+
expect(keyframes).toEqual(["0%", "0%"])
154+
})
140155
})

packages/framer-motion/src/animation/utils/keyframes.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ export function getKeyframes(
3636

3737
if (isNone(keyframes[i])) {
3838
noneKeyframeIndexes.push(i)
39-
} else if (typeof keyframes[i] === "string") {
39+
}
40+
41+
// TODO: Clean this conditional, it works for now
42+
if (
43+
typeof keyframes[i] === "string" &&
44+
keyframes[i] !== "none" &&
45+
keyframes[i] !== "0"
46+
) {
4047
animatableTemplateValue = keyframes[i] as string
4148
}
4249
}

0 commit comments

Comments
 (0)