Skip to content

Commit

Permalink
Move and Rename propType definitions in TransformPropTypes (facebook#…
Browse files Browse the repository at this point in the history
…21375)

Summary:
related facebook#21342

move TransformPropTypes.js
fix flow error

- [x] yarn prettier
- [x] yarn flow-check-android
- [x] yarn flow-check-ios

All flow checks pass.

[GENERAL] [ENHANCEMENT] [DeprecatedTransformPropTypes.js] - Created.
Pull Request resolved: facebook#21375

Differential Revision: D10095453

Pulled By: TheSavior

fbshipit-source-id: fbf677a000e3c6c0bd31e915dcafbd2d561be6e3
  • Loading branch information
gvarandas authored and facebook-github-bot committed Sep 27, 2018
1 parent 0b1b3a1 commit 2145bda
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 31 deletions.
4 changes: 2 additions & 2 deletions Libraries/Components/View/ViewStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ const ColorPropType = require('ColorPropType');
const LayoutPropTypes = require('LayoutPropTypes');
const ReactPropTypes = require('prop-types');
const ShadowPropTypesIOS = require('ShadowPropTypesIOS');
const TransformPropTypes = require('TransformPropTypes');
const DeprecatedTransformPropTypes = require('DeprecatedTransformPropTypes');

/**
* Warning: Some of these properties may not be supported in all releases.
*/
const ViewStylePropTypes = {
...LayoutPropTypes,
...ShadowPropTypesIOS,
...TransformPropTypes,
...DeprecatedTransformPropTypes,
backfaceVisibility: ReactPropTypes.oneOf(['visible', 'hidden']),
backgroundColor: ColorPropType,
borderColor: ColorPropType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,7 @@ const DecomposedMatrixPropType = function(
}
};

const TransformPropTypes = {
/**
* `transform` accepts an array of transformation objects. Each object specifies
* the property that will be transformed as the key, and the value to use in the
* transformation. Objects should not be combined. Use a single key/value pair
* per object.
*
* The rotate transformations require a string so that the transform may be
* expressed in degrees (deg) or radians (rad). For example:
*
* `transform([{ rotateX: '45deg' }, { rotateZ: '0.785398rad' }])`
*
* The skew transformations require a string so that the transform may be
* expressed in degrees (deg). For example:
*
* `transform([{ skewX: '45deg' }])`
*/
const DeprecatedTransformPropTypes = {
transform: ReactPropTypes.arrayOf(
ReactPropTypes.oneOfType([
ReactPropTypes.shape({perspective: ReactPropTypes.number}),
Expand All @@ -73,17 +57,8 @@ const TransformPropTypes = {
ReactPropTypes.shape({skewY: ReactPropTypes.string}),
]),
),

/**
* Deprecated. Use the transform prop instead.
*/
transformMatrix: TransformMatrixPropType,
/**
* Deprecated. Use the transform prop instead.
*/
decomposedMatrix: DecomposedMatrixPropType,

/* Deprecated transform props used on Android only */
scaleX: deprecatedPropType(
ReactPropTypes.number,
'Use the transform prop instead.',
Expand All @@ -106,4 +81,4 @@ const TransformPropTypes = {
),
};

module.exports = TransformPropTypes;
module.exports = DeprecatedTransformPropTypes;
4 changes: 2 additions & 2 deletions Libraries/Image/ImageStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ const ImageResizeMode = require('ImageResizeMode');
const LayoutPropTypes = require('LayoutPropTypes');
const ReactPropTypes = require('prop-types');
const ShadowPropTypesIOS = require('ShadowPropTypesIOS');
const TransformPropTypes = require('TransformPropTypes');
const DeprecatedTransformPropTypes = require('DeprecatedTransformPropTypes');

const ImageStylePropTypes = {
...LayoutPropTypes,
...ShadowPropTypesIOS,
...TransformPropTypes,
...DeprecatedTransformPropTypes,
resizeMode: ReactPropTypes.oneOf(Object.keys(ImageResizeMode)),
backfaceVisibility: ReactPropTypes.oneOf(['visible', 'hidden']),
backgroundColor: ColorPropType,
Expand Down
16 changes: 16 additions & 0 deletions Libraries/StyleSheet/StyleSheetTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ export type ____LayoutStyle_Internal = $ReadOnly<{|
|}>;

export type ____TransformStyle_Internal = $ReadOnly<{|
/**
* `transform` accepts an array of transformation objects. Each object specifies
* the property that will be transformed as the key, and the value to use in the
* transformation. Objects should not be combined. Use a single key/value pair
* per object.
*
* The rotate transformations require a string so that the transform may be
* expressed in degrees (deg) or radians (rad). For example:
*
* `transform([{ rotateX: '45deg' }, { rotateZ: '0.785398rad' }])`
*
* The skew transformations require a string so that the transform may be
* expressed in degrees (deg). For example:
*
* `transform([{ skewX: '45deg' }])`
*/
transform?: $ReadOnlyArray<
| {|+perspective: number | AnimatedNode|}
| {|+rotate: string | AnimatedNode|}
Expand Down

0 comments on commit 2145bda

Please # to comment.