Move and rename StyleSheetPropType to DeprecatedStyleSheetPropType (#21380)

Summary:
This PR moves and renames all references of StyleSheetPropType  to DeprecatedStyleSheetPropType
Related to #21342
Pull Request resolved: https://github.com/facebook/react-native/pull/21380

Differential Revision: D10098216

Pulled By: TheSavior

fbshipit-source-id: da8d927f87bd37cdabc315e0aa17b6ae208f7124
This commit is contained in:
Dani
2018-09-27 22:53:16 -07:00
committed by Facebook Github Bot
parent f94d2ade86
commit d8b40cc541
5 changed files with 10 additions and 10 deletions

View File

@@ -0,0 +1,31 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow strict-local
*/
'use strict';
const createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
const flattenStyle = require('flattenStyle');
function DeprecatedStyleSheetPropType(shape: {
[key: string]: ReactPropsCheckType,
}): ReactPropsCheckType {
const shapePropType = createStrictShapeTypeChecker(shape);
return function(props, propName, componentName, location?, ...rest) {
let newProps = props;
if (props[propName]) {
// Just make a dummy prop object with only the flattened style
newProps = {};
newProps[propName] = flattenStyle(props[propName]);
}
return shapePropType(newProps, propName, componentName, location, ...rest);
};
}
module.exports = DeprecatedStyleSheetPropType;

View File

@@ -13,7 +13,7 @@
const DeprecatedEdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType');
const PlatformViewPropTypes = require('PlatformViewPropTypes');
const PropTypes = require('prop-types');
const StyleSheetPropType = require('StyleSheetPropType');
const DeprecatedStyleSheetPropType = require('DeprecatedStyleSheetPropType');
const ViewStylePropTypes = require('ViewStylePropTypes');
const {
@@ -23,7 +23,7 @@ const {
AccessibilityStates,
} = require('ViewAccessibility');
const stylePropType = StyleSheetPropType(ViewStylePropTypes);
const stylePropType = DeprecatedStyleSheetPropType(ViewStylePropTypes);
module.exports = {
/**