From d177a45bdce124b635dbc31ab0949d2e9d139eb3 Mon Sep 17 00:00:00 2001 From: Peter Zich Date: Wed, 6 May 2015 14:28:05 -0700 Subject: [PATCH] [ReactNative] Pull transform properties out into TransformPropTypes --- .../Components/View/ViewStylePropTypes.js | 11 ++------ Libraries/Image/ImageStylePropTypes.js | 2 ++ Libraries/StyleSheet/TransformPropTypes.js | 28 +++++++++++++++++++ 3 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 Libraries/StyleSheet/TransformPropTypes.js diff --git a/Libraries/Components/View/ViewStylePropTypes.js b/Libraries/Components/View/ViewStylePropTypes.js index a5b591a61f8ef6..c1f6b4b1ccf7d5 100644 --- a/Libraries/Components/View/ViewStylePropTypes.js +++ b/Libraries/Components/View/ViewStylePropTypes.js @@ -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, @@ -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; diff --git a/Libraries/Image/ImageStylePropTypes.js b/Libraries/Image/ImageStylePropTypes.js index d46807ce7c2a14..c70bee73a1908e 100644 --- a/Libraries/Image/ImageStylePropTypes.js +++ b/Libraries/Image/ImageStylePropTypes.js @@ -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, diff --git a/Libraries/StyleSheet/TransformPropTypes.js b/Libraries/StyleSheet/TransformPropTypes.js new file mode 100644 index 00000000000000..9338f7ff5f83bf --- /dev/null +++ b/Libraries/StyleSheet/TransformPropTypes.js @@ -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;