mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
e68cf7cee9
Summary: This diff removes the call to UIManager.getViewManagerConfig into the deprecatedPropType method when static view configs are enabled This was necessary to avoid innecessary calls to UIManager.getViewManagerConfig and to avoid loading UIManagerModule classes when static view configs are enabled changelog: [internal] internal Reviewed By: fkgozali, yungsters Differential Revision: D26040855 fbshipit-source-id: 82cad9f4abe9898e781fd989ebaa03497dad926b
39 lines
952 B
JavaScript
39 lines
952 B
JavaScript
/**
|
|
* 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';
|
|
|
|
import UIManager from '../ReactNative/UIManager';
|
|
|
|
/**
|
|
* Adds a deprecation warning when the prop is used.
|
|
*/
|
|
function deprecatedPropType(
|
|
propType: ReactPropsCheckType,
|
|
explanation: string,
|
|
): ReactPropsCheckType {
|
|
return function validate(props, propName, componentName, ...rest) {
|
|
// Don't warn for native components.
|
|
if (
|
|
!global.RN$Bridgeless &&
|
|
UIManager.hasViewManagerConfig(componentName) &&
|
|
props[propName] !== undefined
|
|
) {
|
|
console.warn(
|
|
`\`${propName}\` supplied to \`${componentName}\` has been deprecated. ${explanation}`,
|
|
);
|
|
}
|
|
|
|
return propType(props, propName, componentName, ...rest);
|
|
};
|
|
}
|
|
|
|
module.exports = deprecatedPropType;
|