Skip to content

Commit 339d9d3

Browse files
fkgozalifacebook-github-bot
authored andcommitted
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
1 parent d7a0c44 commit 339d9d3

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Libraries/Utilities/Platform.android.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ const Platform = {
1919
return constants && constants.Version;
2020
},
2121
get isTesting(): boolean {
22-
const constants = NativeModules.PlatformConstants;
23-
return constants && constants.isTesting;
22+
if (__DEV__) {
23+
const constants = NativeModules.PlatformConstants;
24+
return constants && constants.isTesting;
25+
}
26+
return false;
2427
},
2528
get isTV(): boolean {
2629
const constants = NativeModules.PlatformConstants;

Libraries/Utilities/Platform.ios.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ const Platform = {
3333
return constants ? constants.interfaceIdiom === 'tv' : false;
3434
},
3535
get isTesting(): boolean {
36-
const constants = NativeModules.PlatformConstants;
37-
return constants && constants.isTesting;
36+
if (__DEV__) {
37+
const constants = NativeModules.PlatformConstants;
38+
return constants && constants.isTesting;
39+
}
40+
return false;
3841
},
3942
select: (obj: Object) => ('ios' in obj ? obj.ios : obj.default),
4043
};

0 commit comments

Comments
 (0)