Add support for translateX and translateY on web (#1825)

Props translateX and translateY are ignored on web. This PR is addressing it the same way as it is already done for originX and originY.

This PR is not addressing the issue of transform as stated in issue.
This commit is contained in:
Robert Sasak
2022-08-10 10:27:35 +02:00
committed by GitHub
parent b00579a957
commit 4062c2e2b8
+7
View File
@@ -45,6 +45,8 @@ interface BaseProps {
rejectResponderTermination?: boolean;
translate: NumberArray;
translateX: NumberProp;
translateY: NumberProp;
scale: NumberArray;
rotation: NumberArray;
skewX: NumberProp;
@@ -78,6 +80,8 @@ const prepare = <T extends BaseProps>(
) => {
const {
translate,
translateX,
translateY,
scale,
rotation,
skewX,
@@ -128,6 +132,9 @@ const prepare = <T extends BaseProps>(
if (translate != null) {
transform.push(`translate(${translate})`);
}
if (translateX != null || translateY != null) {
transform.push(`translate(${translateX || 0}, ${translateY || 0})`);
}
if (scale != null) {
transform.push(`scale(${scale})`);
}