Workaround native module dependency in Jest environment

Reviewed By: josephsavona

Differential Revision: D4225750

fbshipit-source-id: 6ac5a5cc1869232861977ea214970804acd7e39d
This commit is contained in:
Jennifer Wang 2016-11-22 23:49:44 -08:00 committed by Facebook Github Bot
parent 90284eb67d
commit be5868dddb
1 changed files with 2 additions and 1 deletions

View File

@ -15,7 +15,8 @@
var Platform = {
OS: 'android',
get Version() {
return require('NativeModules').AndroidConstants.Version;
const AndroidConstants = require('NativeModules').AndroidConstants;
return AndroidConstants && AndroidConstants.Version;
},
select: (obj: Object) => obj.android,
};