mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-27 19:25:11 +08:00
Don't assume the SourceCode native module exists
Reviewed By: yungsters Differential Revision: D7185837 fbshipit-source-id: e8efc22ac0af092dbc1fdf616b0b3f111390dd5d
This commit is contained in:
committed by
Facebook Github Bot
parent
596bcb6d84
commit
8cdc7d3e02
@@ -25,7 +25,7 @@ type DevServerInfo = {
|
||||
*/
|
||||
function getDevServer(): DevServerInfo {
|
||||
if (_cachedDevServerURL === undefined) {
|
||||
const match = SourceCode.scriptURL && SourceCode.scriptURL.match(/^https?:\/\/.*?\//);
|
||||
const match = SourceCode && SourceCode.scriptURL && SourceCode.scriptURL.match(/^https?:\/\/.*?\//);
|
||||
_cachedDevServerURL = match ? match[0] : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ if (!sourceCode) {
|
||||
const NativeModules = require('NativeModules');
|
||||
sourceCode = NativeModules && NativeModules.SourceCode;
|
||||
}
|
||||
_sourceCodeScriptURL = sourceCode.scriptURL;
|
||||
_sourceCodeScriptURL = sourceCode && sourceCode.scriptURL;
|
||||
|
||||
module.exports = resolveAssetSource;
|
||||
module.exports.pickScale = AssetSourceResolver.pickScale;
|
||||
|
||||
Reference in New Issue
Block a user