mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Avoid the call to getViewManagerConfig on deprecatedPropType method
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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ec7b2085d8
commit
e68cf7cee9
@@ -20,6 +20,9 @@ module.exports = {
|
||||
}
|
||||
return null;
|
||||
},
|
||||
hasViewManagerConfig: (viewManagerName: string): boolean => {
|
||||
return viewManagerName === 'RCTVirtualText';
|
||||
},
|
||||
getConstants: (): {...} => ({}),
|
||||
getConstantsForViewManager: (viewManagerName: string) => {},
|
||||
getDefaultEventTypes: (): Array<$FlowFixMe> => [],
|
||||
|
||||
@@ -97,6 +97,9 @@ const UIManagerJS = {
|
||||
getViewManagerConfig(viewManagerName: string): any {
|
||||
return getViewManagerConfig(viewManagerName);
|
||||
},
|
||||
hasViewManagerConfig(viewManagerName: string): boolean {
|
||||
return getViewManagerConfig(viewManagerName) != null;
|
||||
},
|
||||
};
|
||||
|
||||
// TODO (T45220498): Remove this.
|
||||
|
||||
@@ -15,6 +15,7 @@ import type {Spec} from './NativeUIManager';
|
||||
|
||||
interface UIManagerJSInterface extends Spec {
|
||||
+getViewManagerConfig: (viewManagerName: string) => Object;
|
||||
+hasViewManagerConfig: (viewManagerName: string) => boolean;
|
||||
+createView: (
|
||||
reactTag: ?number,
|
||||
viewName: string,
|
||||
|
||||
@@ -57,6 +57,7 @@ module.exports = [
|
||||
'AccessibilityEventTypes',
|
||||
'UIView',
|
||||
'getViewManagerConfig',
|
||||
'hasViewManagerConfig',
|
||||
'blur',
|
||||
'focus',
|
||||
'genericBubblingEventTypes',
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const UIManager = require('../ReactNative/UIManager');
|
||||
import UIManager from '../ReactNative/UIManager';
|
||||
|
||||
/**
|
||||
* Adds a deprecation warning when the prop is used.
|
||||
@@ -23,7 +23,7 @@ function deprecatedPropType(
|
||||
// Don't warn for native components.
|
||||
if (
|
||||
!global.RN$Bridgeless &&
|
||||
!UIManager.getViewManagerConfig(componentName) &&
|
||||
UIManager.hasViewManagerConfig(componentName) &&
|
||||
props[propName] !== undefined
|
||||
) {
|
||||
console.warn(
|
||||
|
||||
@@ -69,6 +69,9 @@ jest
|
||||
};
|
||||
}
|
||||
}),
|
||||
hasViewManagerConfig: jest.fn(name => {
|
||||
return true;
|
||||
}),
|
||||
measure: jest.fn(),
|
||||
manageChildren: jest.fn(),
|
||||
removeSubviewsFromContainerWithID: jest.fn(),
|
||||
|
||||
Reference in New Issue
Block a user