Skip to content

Commit

Permalink
Guard Platform.isTesting under __DEV__
Browse files Browse the repository at this point in the history
Summary: Testing is a __DEV__ time only, so let's optimize for prod bundles.

Reviewed By: ejanzer

Differential Revision: D13050583

fbshipit-source-id: a96e35e4d5f3bd09c235c11d4ece3e4d07882de7
  • Loading branch information
fkgozali authored and facebook-github-bot committed Nov 14, 2018
1 parent d7a0c44 commit 339d9d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Libraries/Utilities/Platform.android.js
Expand Up @@ -19,8 +19,11 @@ const Platform = {
return constants && constants.Version;
},
get isTesting(): boolean {
const constants = NativeModules.PlatformConstants;
return constants && constants.isTesting;
if (__DEV__) {
const constants = NativeModules.PlatformConstants;
return constants && constants.isTesting;
}
return false;
},
get isTV(): boolean {
const constants = NativeModules.PlatformConstants;
Expand Down
7 changes: 5 additions & 2 deletions Libraries/Utilities/Platform.ios.js
Expand Up @@ -33,8 +33,11 @@ const Platform = {
return constants ? constants.interfaceIdiom === 'tv' : false;
},
get isTesting(): boolean {
const constants = NativeModules.PlatformConstants;
return constants && constants.isTesting;
if (__DEV__) {
const constants = NativeModules.PlatformConstants;
return constants && constants.isTesting;
}
return false;
},
select: (obj: Object) => ('ios' in obj ? obj.ios : obj.default),
};
Expand Down

0 comments on commit 339d9d3

Please sign in to comment.