mirror of
https://github.com/status-im/react-native.git
synced 2025-02-26 16:10:58 +00:00
Rely only on scriptURL when loading images
Reviewed By: @foghina Differential Revision: D2527119 fb-gh-sync-id: e2a9618f729a2ec03b1959fa13fae46620cc379e
This commit is contained in:
parent
5e33dbcfcc
commit
62d0586e59
@ -25,7 +25,6 @@ function expectResolvesAsset(input, expectedSource) {
|
|||||||
describe('resolveAssetSource', () => {
|
describe('resolveAssetSource', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.resetModuleRegistry();
|
jest.resetModuleRegistry();
|
||||||
__DEV__ = true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns same source for simple static and network images', () => {
|
it('returns same source for simple static and network images', () => {
|
||||||
@ -109,11 +108,10 @@ describe('resolveAssetSource', () => {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('bundle was loaded from file (PROD) on iOS', () => {
|
describe('bundle was loaded from file on iOS', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
NativeModules.SourceCode.scriptURL =
|
NativeModules.SourceCode.scriptURL =
|
||||||
'file:///Path/To/Simulator/main.bundle';
|
'file:///Path/To/Simulator/main.bundle';
|
||||||
__DEV__ = false;
|
|
||||||
Platform.OS = 'ios';
|
Platform.OS = 'ios';
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -138,11 +136,10 @@ describe('resolveAssetSource', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('bundle was loaded from file (PROD) on Android', () => {
|
describe('bundle was loaded from file on Android', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
NativeModules.SourceCode.scriptURL =
|
NativeModules.SourceCode.scriptURL =
|
||||||
'file:///Path/To/Simulator/main.bundle';
|
'file:///Path/To/Simulator/main.bundle';
|
||||||
__DEV__ = false;
|
|
||||||
Platform.OS = 'android';
|
Platform.OS = 'android';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -20,10 +20,6 @@ var SourceCode = require('NativeModules').SourceCode;
|
|||||||
var _serverURL;
|
var _serverURL;
|
||||||
|
|
||||||
function getDevServerURL() {
|
function getDevServerURL() {
|
||||||
if (!__DEV__) {
|
|
||||||
// In prod we want assets to be loaded from the archive
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (_serverURL === undefined) {
|
if (_serverURL === undefined) {
|
||||||
var scriptURL = SourceCode.scriptURL;
|
var scriptURL = SourceCode.scriptURL;
|
||||||
var match = scriptURL && scriptURL.match(/^https?:\/\/.*?\//);
|
var match = scriptURL && scriptURL.match(/^https?:\/\/.*?\//);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user