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
This commit is contained in:
Kevin Gozali
2018-11-13 20:09:21 -08:00
committed by Facebook Github Bot
parent d7a0c44590
commit 339d9d3afb
2 changed files with 10 additions and 4 deletions

View File

@@ -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;

View File

@@ -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),
};