mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-07 13:05:18 +08:00
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:
committed by
Facebook Github Bot
parent
f94d2ade86
commit
d8b40cc541
@@ -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;
|
||||
@@ -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 = {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user