[style] expose rotate x, y, z transforms

Summary:
Added rotateX, rotateY, rotateZ transforms.

cc @sahrens
Closes https://github.com/facebook/react-native/pull/1976
Github Author: chirag04 <jain_chirag04@yahoo.com>
This commit is contained in:
chirag04 2015-07-14 19:41:07 -07:00
parent 19ddbac113
commit 548549ea9f
2 changed files with 14 additions and 0 deletions

View File

@ -17,6 +17,10 @@ var TransformPropTypes = {
transform: ReactPropTypes.arrayOf(
ReactPropTypes.oneOfType([
ReactPropTypes.shape({rotate: ReactPropTypes.string}),
ReactPropTypes.shape({rotateX: ReactPropTypes.string}),
ReactPropTypes.shape({rotateY: ReactPropTypes.string}),
ReactPropTypes.shape({rotateZ: ReactPropTypes.string}),
ReactPropTypes.shape({scale: ReactPropTypes.number}),
ReactPropTypes.shape({scaleX: ReactPropTypes.number}),
ReactPropTypes.shape({scaleY: ReactPropTypes.number}),
ReactPropTypes.shape({translateX: ReactPropTypes.number}),

View File

@ -58,7 +58,14 @@ function _precomputeTransforms(style: Object): Object {
case 'matrix':
MatrixMath.multiplyInto(result, result, value);
break;
case 'rotateX':
_multiplyTransform(result, MatrixMath.reuseRotateXCommand, [_convertToRadians(value)]);
break;
case 'rotateY':
_multiplyTransform(result, MatrixMath.reuseRotateYCommand, [_convertToRadians(value)]);
break;
case 'rotate':
case 'rotateZ':
_multiplyTransform(result, MatrixMath.reuseRotateZCommand, [_convertToRadians(value)]);
break;
case 'scale':
@ -156,6 +163,9 @@ function _validateTransform(key, value, transformation) {
break;
case 'translate':
break;
case 'rotateX':
case 'rotateY':
case 'rotateZ':
case 'rotate':
invariant(
typeof value === 'string',