mirror of
https://github.com/status-im/react-native.git
synced 2025-01-12 18:44:25 +00:00
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 {
|
class StyleSheetValidation {
|
||||||
static validateStyleProp(prop: string, style: Object, caller: string) {
|
static validateStyleProp(prop: string, style: Object, caller: string) {
|
||||||
if (!__DEV__) {
|
if (!__DEV__ || global.__RCTProfileIsProfiling) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (allStylePropTypes[prop] === undefined) {
|
if (allStylePropTypes[prop] === undefined) {
|
||||||
@ -48,7 +48,7 @@ class StyleSheetValidation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static validateStyle(name: string, styles: Object) {
|
static validateStyle(name: string, styles: Object) {
|
||||||
if (!__DEV__) {
|
if (!__DEV__ || global.__RCTProfileIsProfiling) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const prop in styles[name]) {
|
for (const prop in styles[name]) {
|
||||||
@ -61,6 +61,9 @@ class StyleSheetValidation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static addValidStylePropTypes(stylePropTypes) {
|
static addValidStylePropTypes(stylePropTypes) {
|
||||||
|
if (!__DEV__ || global.__RCTProfileIsProfiling) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (const key in stylePropTypes) {
|
for (const key in stylePropTypes) {
|
||||||
allStylePropTypes[key] = stylePropTypes[key];
|
allStylePropTypes[key] = stylePropTypes[key];
|
||||||
}
|
}
|
||||||
@ -81,8 +84,10 @@ const styleError = function(message1, style, caller?, message2?) {
|
|||||||
|
|
||||||
const allStylePropTypes = {};
|
const allStylePropTypes = {};
|
||||||
|
|
||||||
StyleSheetValidation.addValidStylePropTypes(ImageStylePropTypes);
|
if (__DEV__ && !global.__RCTProfileIsProfiling) {
|
||||||
StyleSheetValidation.addValidStylePropTypes(TextStylePropTypes);
|
StyleSheetValidation.addValidStylePropTypes(ImageStylePropTypes);
|
||||||
StyleSheetValidation.addValidStylePropTypes(ViewStylePropTypes);
|
StyleSheetValidation.addValidStylePropTypes(TextStylePropTypes);
|
||||||
|
StyleSheetValidation.addValidStylePropTypes(ViewStylePropTypes);
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = StyleSheetValidation;
|
module.exports = StyleSheetValidation;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user