RN: Ignore StyleSheetValidation if Profiling
Summary: Removes `StyleSheetValidation` when profiling because it creates noise and looks pretty expensive. Reviewed By: TheSavior Differential Revision: D9890117 fbshipit-source-id: cc1b8d4e4bc40be2333f09321892317bc841aae0
This commit is contained in:
parent
24679cd32b
commit
d7b34dd38d
|
@ -24,7 +24,7 @@ const ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|||
|
||||
class StyleSheetValidation {
|
||||
static validateStyleProp(prop: string, style: Object, caller: string) {
|
||||
if (!__DEV__) {
|
||||
if (!__DEV__ || global.__RCTProfileIsProfiling) {
|
||||
return;
|
||||
}
|
||||
if (allStylePropTypes[prop] === undefined) {
|
||||
|
@ -48,7 +48,7 @@ class StyleSheetValidation {
|
|||
}
|
||||
|
||||
static validateStyle(name: string, styles: Object) {
|
||||
if (!__DEV__) {
|
||||
if (!__DEV__ || global.__RCTProfileIsProfiling) {
|
||||
return;
|
||||
}
|
||||
for (const prop in styles[name]) {
|
||||
|
@ -61,6 +61,9 @@ class StyleSheetValidation {
|
|||
}
|
||||
|
||||
static addValidStylePropTypes(stylePropTypes) {
|
||||
if (!__DEV__ || global.__RCTProfileIsProfiling) {
|
||||
return;
|
||||
}
|
||||
for (const key in stylePropTypes) {
|
||||
allStylePropTypes[key] = stylePropTypes[key];
|
||||
}
|
||||
|
@ -81,8 +84,10 @@ const styleError = function(message1, style, caller?, message2?) {
|
|||
|
||||
const allStylePropTypes = {};
|
||||
|
||||
StyleSheetValidation.addValidStylePropTypes(ImageStylePropTypes);
|
||||
StyleSheetValidation.addValidStylePropTypes(TextStylePropTypes);
|
||||
StyleSheetValidation.addValidStylePropTypes(ViewStylePropTypes);
|
||||
if (__DEV__ && !global.__RCTProfileIsProfiling) {
|
||||
StyleSheetValidation.addValidStylePropTypes(ImageStylePropTypes);
|
||||
StyleSheetValidation.addValidStylePropTypes(TextStylePropTypes);
|
||||
StyleSheetValidation.addValidStylePropTypes(ViewStylePropTypes);
|
||||
}
|
||||
|
||||
module.exports = StyleSheetValidation;
|
||||
|
|
Loading…
Reference in New Issue