Skip to content

Commit

Permalink
Enable animating skew in transforms with native driver (#36933)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #36933

Skew is already supported on the platform side; there's no reason to disable animating it.

Changelog:
[General][Added] - Enable animating skew in transforms with native driver

Reviewed By: mdvacca

Differential Revision: D45053914

fbshipit-source-id: 31198c35eeb55211a3ff88c968707db65b025f49
  • Loading branch information
genkikondo authored and facebook-github-bot committed Apr 18, 2023
1 parent e2e59c4 commit 645b643
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ const SUPPORTED_TRANSFORMS = {
rotateY: true,
rotateZ: true,
perspective: true,
skewX: true,
skewY: true,
matrix: ReactNativeFeatureFlags.shouldUseAnimatedObjectForTransform(),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export type ____TransformStyle_Internal = $ReadOnly<{|
| [number | AnimatedNode, number | AnimatedNode]
| AnimatedNode,
|}
| {|+skewX: string|}
| {|+skewY: string|}
| {|+skewX: string | AnimatedNode|}
| {|+skewY: string | AnimatedNode|}
// TODO: what is the actual type it expects?
| {|
+matrix: $ReadOnlyArray<number | AnimatedNode> | AnimatedNode,
Expand Down
14 changes: 2 additions & 12 deletions packages/rn-tester/js/examples/Animated/TransformStylesExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ function AnimatedView({
);
}

function notSupportedByNativeDriver(property: string) {
return property === 'skewX' || property === 'skewY';
}

function AnimatedTransformStyleExample(): React.Node {
const [properties, setProperties] = React.useState(transformProperties);
const [useNativeDriver, setUseNativeDriver] = React.useState(false);
Expand Down Expand Up @@ -109,9 +105,6 @@ function AnimatedTransformStyleExample(): React.Node {
key={property}
label={property}
multiSelect
disabled={
notSupportedByNativeDriver(property) && useNativeDriver
}
selected={properties[property].selected}
onPress={() => {
onToggle(property);
Expand All @@ -127,9 +120,7 @@ function AnimatedTransformStyleExample(): React.Node {
useNativeDriver={useNativeDriver}
// $FlowFixMe[incompatible-call]
properties={Object.keys(properties).filter(
property =>
properties[property].selected &&
!(useNativeDriver && notSupportedByNativeDriver(property)),
property => properties[property].selected,
)}
/>
</View>
Expand Down Expand Up @@ -163,7 +154,6 @@ const styles = StyleSheet.create({
export default ({
title: 'Transform Styles',
name: 'transformStyles',
description:
'Variations of transform styles. `skewX` and `skewY` are not supported on native driver.',
description: 'Variations of transform styles.',
render: () => <AnimatedTransformStyleExample />,
}: RNTesterModuleExample);

0 comments on commit 645b643

Please sign in to comment.