Fix skew transform on native side (iOS & Android)

Summary:
According to #11992 fix skew transform in native code as well

janicduplessis vjeux
Closes https://github.com/facebook/react-native/pull/12106

Differential Revision: D4479880

fbshipit-source-id: d84780842b555f6352d84d229b5b6c5c3c6a0647
This commit is contained in:
Max Graey 2017-01-28 12:36:57 -08:00 committed by Facebook Github Bot
parent 850c71c2f3
commit c68195929b
2 changed files with 4 additions and 8 deletions

View File

@ -118,13 +118,11 @@ static const NSUInteger kMatrixArrayLength = 4 * 4;
} else if ([property isEqualToString:@"skewX"]) { } else if ([property isEqualToString:@"skewX"]) {
CGFloat skew = [self convertToRadians:value]; CGFloat skew = [self convertToRadians:value];
transform.m21 = sinf(skew); transform.m21 = tanf(skew);
transform.m22 = cosf(skew);
} else if ([property isEqualToString:@"skewY"]) { } else if ([property isEqualToString:@"skewY"]) {
CGFloat skew = [self convertToRadians:value]; CGFloat skew = [self convertToRadians:value];
transform.m11 = cosf(skew); transform.m12 = tanf(skew);
transform.m12 = sinf(skew);
} else { } else {
RCTLogError(@"Unsupported transform type for a CATransform3D: %@.", property); RCTLogError(@"Unsupported transform type for a CATransform3D: %@.", property);

View File

@ -426,13 +426,11 @@ public class MatrixMathHelper {
} }
public static void applySkewX(double[] m, double radians) { public static void applySkewX(double[] m, double radians) {
m[4] = Math.sin(radians); m[4] = Math.tan(radians);
m[5] = Math.cos(radians);
} }
public static void applySkewY(double[] m, double radians) { public static void applySkewY(double[] m, double radians) {
m[0] = Math.cos(radians); m[1] = Math.tan(radians);
m[1] = Math.sin(radians);
} }
public static void applyRotateX(double[] m, double radians) { public static void applyRotateX(double[] m, double radians) {