Skip to content

Commit 6aa13cd

Browse files
fix(web): skip identity transform values and none transitions in CSS output
1 parent 87f4548 commit 6aa13cd

1 file changed

Lines changed: 19 additions & 9 deletions

File tree

src/EaseView.web.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ export function EaseView({
231231
!mounted && hasInitial
232232
? 'none'
233233
: (Object.keys(CSS_PROP_MAP) as CategoryKey[])
234+
.filter((key) => categoryConfigs[key].type !== 'none')
234235
.map((key) => {
235236
const cfg = categoryConfigs[key];
236-
if (cfg.type === 'none') return `${CSS_PROP_MAP[key]} 0ms linear`;
237237
const springEasing =
238238
cfg.type === 'spring'
239239
? 'cubic-bezier(0.25, 0.46, 0.45, 0.94)'
@@ -242,7 +242,7 @@ export function EaseView({
242242
springEasing ?? cfg.easing
243243
}`;
244244
})
245-
.join(', ');
245+
.join(', ') || 'none';
246246

247247
// Apply CSS transition/animation properties imperatively (not in RN style spec).
248248
useEffect(() => {
@@ -346,13 +346,23 @@ export function EaseView({
346346
const animatedStyle: ViewStyle = {
347347
opacity: displayValues.opacity,
348348
transform: [
349-
{ translateX: displayValues.translateX },
350-
{ translateY: displayValues.translateY },
351-
{ scaleX: displayValues.scaleX },
352-
{ scaleY: displayValues.scaleY },
353-
{ rotate: `${displayValues.rotate}deg` },
354-
{ rotateX: `${displayValues.rotateX}deg` },
355-
{ rotateY: `${displayValues.rotateY}deg` },
349+
...(displayValues.translateX !== 0
350+
? [{ translateX: displayValues.translateX }]
351+
: []),
352+
...(displayValues.translateY !== 0
353+
? [{ translateY: displayValues.translateY }]
354+
: []),
355+
...(displayValues.scaleX !== 1 ? [{ scaleX: displayValues.scaleX }] : []),
356+
...(displayValues.scaleY !== 1 ? [{ scaleY: displayValues.scaleY }] : []),
357+
...(displayValues.rotate !== 0
358+
? [{ rotate: `${displayValues.rotate}deg` }]
359+
: []),
360+
...(displayValues.rotateX !== 0
361+
? [{ rotateX: `${displayValues.rotateX}deg` }]
362+
: []),
363+
...(displayValues.rotateY !== 0
364+
? [{ rotateY: `${displayValues.rotateY}deg` }]
365+
: []),
356366
],
357367
...(displayValues.borderRadius > 0
358368
? { borderRadius: displayValues.borderRadius }

0 commit comments

Comments
 (0)