mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-02 22:41:18 +08:00
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:
committed by
Facebook Github Bot
parent
d7a0c44590
commit
339d9d3afb
@@ -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),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user