Skip to content

Fix native-driver detection for skew transforms in transitions#508

Open
durvesh1992 wants to merge 1 commit into
react:mainfrom
durvesh1992:fix-skew-transition-native-driver
Open

Fix native-driver detection for skew transforms in transitions#508
durvesh1992 wants to merge 1 commit into
react:mainfrom
durvesh1992:fix-skew-transition-native-driver

Conversation

@durvesh1992

Copy link
Copy Markdown

Summary

canUseNativeDriver in useStyleTransition decides whether a CSS transition can run on React Native's native animation driver. For the transform property it tried to exclude skew transforms with:

property === 'transform' && Array.isArray(value) && !value.includes('skew')

But value is an array of transform objects (e.g. [{ skewX: '10deg' }]), not strings, so value.includes('skew') is always false. The skew guard was therefore a dead no-op, and a transition involving skewX/skewY was incorrectly marked as native-driver compatible. The native driver does not support skew, so these transitions must fall back to the JS driver.

Fix

Detect skew by inspecting each transform object's keys (skewX/skewY) instead of doing a string includes on the array.

Test plan

Added a regression test under css.create() > properties: "transition" that animates a skewX transform and asserts Animated.timing is called with useNativeDriver: false (fails before the fix — it was true — and passes after). Existing transform/opacity transition tests (which should keep useNativeDriver: true) still pass. Full jest suite passes (902 tests), flow check reports no errors, and eslint is clean.

canUseNativeDriver checked `value.includes('skew')` on the transform
value, but that value is an array of transform objects (e.g.
`[{ skewX: '10deg' }]`), so the string check never matched and skew
transforms were always treated as native-driver compatible.

The native animation driver does not support skew, so transitions
involving skewX/skewY must fall back to the JS driver. Detect skew by
inspecting each transform object's keys instead.

Add a regression test asserting useNativeDriver is false for a skew
transform transition.
@meta-cla meta-cla Bot added the cla signed label Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant