Skip to content

Commit

Permalink
[ReactNative] Pull transform properties out into TransformPropTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
pzich committed May 6, 2015
1 parent 40e3f6e commit d177a45
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
11 changes: 2 additions & 9 deletions Libraries/Components/View/ViewStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@

var LayoutPropTypes = require('LayoutPropTypes');
var ReactPropTypes = require('ReactPropTypes');
var TransformPropTypes = require('TransformPropTypes');

/**
* Warning: Some of these properties may not be supported in all releases.
*/
var ViewStylePropTypes = {
...LayoutPropTypes,
...TransformPropTypes,
backgroundColor: ReactPropTypes.string,
borderColor: ReactPropTypes.string,
borderTopColor: ReactPropTypes.string,
Expand All @@ -34,15 +36,6 @@ var ViewStylePropTypes = {
),
shadowOpacity: ReactPropTypes.number,
shadowRadius: ReactPropTypes.number,
transform: ReactPropTypes.arrayOf(ReactPropTypes.object),
transformMatrix: ReactPropTypes.arrayOf(ReactPropTypes.number),

// DEPRECATED
rotation: ReactPropTypes.number,
scaleX: ReactPropTypes.number,
scaleY: ReactPropTypes.number,
translateX: ReactPropTypes.number,
translateY: ReactPropTypes.number,
};

module.exports = ViewStylePropTypes;
2 changes: 2 additions & 0 deletions Libraries/Image/ImageStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
var ImageResizeMode = require('ImageResizeMode');
var LayoutPropTypes = require('LayoutPropTypes');
var ReactPropTypes = require('ReactPropTypes');
var TransformPropTypes = require('TransformPropTypes');

var ImageStylePropTypes = {
...LayoutPropTypes,
...TransformPropTypes,
resizeMode: ReactPropTypes.oneOf(Object.keys(ImageResizeMode)),
backgroundColor: ReactPropTypes.string,
borderColor: ReactPropTypes.string,
Expand Down
28 changes: 28 additions & 0 deletions Libraries/StyleSheet/TransformPropTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule TransformPropTypes
* @flow
*/
'use strict';

var ReactPropTypes = require('ReactPropTypes');

var TransformPropTypes = {
transform: ReactPropTypes.arrayOf(ReactPropTypes.object),
transformMatrix: ReactPropTypes.arrayOf(ReactPropTypes.number),

// DEPRECATED
rotation: ReactPropTypes.number,
scaleX: ReactPropTypes.number,
scaleY: ReactPropTypes.number,
translateX: ReactPropTypes.number,
translateY: ReactPropTypes.number,
};

module.exports = TransformPropTypes;

8 comments on commit d177a45

@brentvatne
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit broke the docs :( Links to http://facebook.github.io/react-native/docs/transformproptypes.html#style which doesn't exist

@brentvatne
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2f97551

@pzich
Copy link
Contributor Author

@pzich pzich commented on d177a45 May 7, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, thanks for fixing this!

@brentvatne
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pzich - no problem 😄

@premasagar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Libraries/Components/View/ViewStylePropTypes.js should include borderWidth: ReactPropTypes.number, shouldn't it? I notice that borderWidth isn't listed in https://facebook.github.io/react-native/docs/view.html#style

@brentvatne
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@premasagar that's included in the flexbox documentation because it affects layout

@premasagar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes. Thanks.

@brentvatne
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄 I can see why that might have caused some confusion though

Please sign in to comment.