Permalink
Browse files

Guard Platform.isTesting under __DEV__

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 339d9d3afba45bb28073db59e365caea37258891
Showing with 10 additions and 4 deletions.
  1. +5 −2 Libraries/Utilities/Platform.android.js
  2. +5 −2 Libraries/Utilities/Platform.ios.js
@@ -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;
@@ -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),
};

0 comments on commit 339d9d3

Please sign in to comment.