You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add string support to the transform property (#34660)
Summary:
This updates the `transform` property to support string values as requested on #34425. This also updates the existing unit tests of the `processTransform` function ensuring the style processing works as expected and updates the TransformExample on RNTester in order to facilitate the manual QA of this.
## Changelog
[General] [Added] - Add string support to the transform property
Pull Request resolved: #34660
Test Plan:
1. Open the RNTester app and navigate to the Transforms page
2. Check the transform style through the `Transform using a string` section
https://user-images.githubusercontent.com/11707729/189550548-ee3c14dd-11c6-4fd1-bd74-f6b52ecb9eae.mov
Reviewed By: lunaleaps
Differential Revision: D39423409
Pulled By: cipolleschi
fbshipit-source-id: 0d7b79178eb33f34ae55a070ce094360b544361f
Copy file name to clipboardExpand all lines: Libraries/StyleSheet/__tests__/__snapshots__/processTransform-test.js.snap
+11-1
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
exports[`processTransform validation should throw on invalid transform property 1`] =`"Invalid transform translateW: {\\"translateW\\":10}"`;
4
4
5
+
exports[`processTransform validation should throw on invalid transform property 2`] =`"Invalid transform translateW: {\\"translateW\\":10}"`;
6
+
5
7
exports[`processTransform validation should throw on object with multiple properties 1`] =`"You must specify exactly one property per transform object. Passed properties: {\\"scale\\":0.5,\\"translateY\\":10}"`;
6
8
7
9
exports[`processTransform validation should throw when not passing an array to an array prop 1`] =`"Transform with key of matrix must have an array as the value: {\\"matrix\\":\\"not-a-matrix\\"}"`;
@@ -10,17 +12,25 @@ exports[`processTransform validation should throw when not passing an array to a
10
12
11
13
exports[`processTransform validation should throw when passing a matrix of the wrong size 1`] =`"Matrix transform must have a length of 9 (2d) or 16 (3d). Provided matrix has a length of 4: {\\"matrix\\":[1,1,1,1]}"`;
12
14
15
+
exports[`processTransform validation should throw when passing a matrix of the wrong size 2`] =`"Matrix transform must have a length of 9 (2d) or 16 (3d). Provided matrix has a length of 4: {\\"matrix\\":[1,1,1,1]}"`;
16
+
13
17
exports[`processTransform validation should throw when passing a perspective of 0 1`] =`"Transform with key of \\"perspective\\" cannot be zero: {\\"perspective\\":0}"`;
14
18
15
19
exports[`processTransform validation should throw when passing a translate of the wrong size 1`] =`"Transform with key translate must be an array of length 2 or 3, found 1: {\\"translate\\":[1]}"`;
16
20
17
21
exports[`processTransform validation should throw when passing a translate of the wrong size 2`] =`"Transform with key translate must be an array of length 2 or 3, found 4: {\\"translate\\":[1,1,1,1]}"`;
18
22
23
+
exports[`processTransform validation should throw when passing a translate of the wrong size 3`] =`"Transform with key translate must be an string with 1 or 2 parameters, found 4: translate(1px, 1px, 1px, 1px)"`;
24
+
19
25
exports[`processTransform validation should throw when passing an Animated.Value 1`] =`"You passed an Animated.Value to a normal component. You need to wrap that component in an Animated. For example, replace <View /> by <Animated.View />."`;
20
26
21
27
exports[`processTransform validation should throw when passing an invalid angle prop 1`] =`"Transform with key of \\"rotate\\" must be a string: {\\"rotate\\":10}"`;
22
28
23
-
exports[`processTransform validation should throw when passing an invalid angle prop 2`] =`"Rotate transform must be expressed in degrees (deg) or radians (rad): {\\"skewX\\":\\"10drg\\"}"`;
29
+
exports[`processTransform validation should throw when passing an invalid angle prop 2`] =`"Transform with key of \\"rotate\\" must be a string: {\\"rotate\\":10}"`;
30
+
31
+
exports[`processTransform validation should throw when passing an invalid angle prop 3`] =`"Rotate transform must be expressed in degrees (deg) or radians (rad): {\\"skewX\\":\\"10drg\\"}"`;
32
+
33
+
exports[`processTransform validation should throw when passing an invalid angle prop 4`] =`"Rotate transform must be expressed in degrees (deg) or radians (rad): {\\"skewX\\":\\"10drg\\"}"`;
24
34
25
35
exports[`processTransform validation should throw when passing an invalid value to a number prop 1`] =`"Transform with key of \\"translateY\\" must be a number: {\\"translateY\\":\\"20deg\\"}"`;
0 commit comments