Removed references to isStatic from the codebase
Summary: @public The legacy 'isStatic' property for image sources is no longer used anywhere in our codebase, but was still being generated by the packager and referenced in the JS in various places. This diff removes all the remaining references. Reviewed By: @frantic Differential Revision: D2531263 fb-gh-sync-id: 0bba0bb8473b1baa908ef7507cbf6d83efb0d9ee
This commit is contained in:
parent
aabdc9cc9f
commit
5b425278bb
|
@ -16,7 +16,6 @@
|
|||
|
||||
module.exports = {
|
||||
__packager_asset: true,
|
||||
isStatic: true,
|
||||
path: '/full/path/to/something.png',
|
||||
uri: 'icon',
|
||||
width: 100,
|
||||
|
|
|
@ -126,12 +126,6 @@ var Image = React.createClass({
|
|||
}
|
||||
|
||||
if (source && source.uri) {
|
||||
var isNetwork = source.uri.match(/^https?:/);
|
||||
invariant(
|
||||
!(isNetwork && source.isStatic),
|
||||
'Static image URIs cannot start with "http": "' + source.uri + '"'
|
||||
);
|
||||
|
||||
var {width, height} = source;
|
||||
var style = flattenStyle([{width, height}, styles.base, this.props.style]);
|
||||
|
||||
|
|
|
@ -13,5 +13,4 @@
|
|||
|
||||
type ImageSource = {
|
||||
uri: string;
|
||||
isStatic: boolean;
|
||||
};
|
||||
|
|
|
@ -31,19 +31,17 @@ describe('resolveAssetSource', () => {
|
|||
var source1 = {uri: 'https://www.facebook.com/logo'};
|
||||
expect(resolveAssetSource(source1)).toBe(source1);
|
||||
|
||||
var source2 = {isStatic: true, uri: 'logo'};
|
||||
var source2 = {uri: 'logo'};
|
||||
expect(resolveAssetSource(source2)).toBe(source2);
|
||||
});
|
||||
|
||||
it('does not change deprecated assets', () => {
|
||||
expect(resolveAssetSource({
|
||||
isStatic: true,
|
||||
deprecated: true,
|
||||
width: 100,
|
||||
height: 200,
|
||||
uri: 'logo',
|
||||
})).toEqual({
|
||||
isStatic: true,
|
||||
deprecated: true,
|
||||
width: 100,
|
||||
height: 200,
|
||||
|
@ -77,7 +75,6 @@ describe('resolveAssetSource', () => {
|
|||
type: 'png',
|
||||
}, {
|
||||
__packager_asset: true,
|
||||
isStatic: false,
|
||||
width: 100,
|
||||
height: 200,
|
||||
uri: 'http://10.0.0.1:8081/assets/module/a/logo.png?platform=ios&hash=5b6f00f',
|
||||
|
@ -98,7 +95,6 @@ describe('resolveAssetSource', () => {
|
|||
type: 'png',
|
||||
}, {
|
||||
__packager_asset: true,
|
||||
isStatic: false,
|
||||
width: 100,
|
||||
height: 200,
|
||||
uri: 'http://10.0.0.1:8081/assets/module/a/logo@2x.png?platform=ios&hash=5b6f00f',
|
||||
|
@ -128,7 +124,6 @@ describe('resolveAssetSource', () => {
|
|||
type: 'png',
|
||||
}, {
|
||||
__packager_asset: true,
|
||||
isStatic: true,
|
||||
width: 100,
|
||||
height: 200,
|
||||
uri: 'assets/module/a/logo.png',
|
||||
|
@ -157,7 +152,6 @@ describe('resolveAssetSource', () => {
|
|||
type: 'png',
|
||||
}, {
|
||||
__packager_asset: true,
|
||||
isStatic: true,
|
||||
width: 100,
|
||||
height: 200,
|
||||
uri: 'awesomemodule_subdir_logo1_',
|
||||
|
|
|
@ -18,7 +18,6 @@ export type ResolvedAssetSource = {
|
|||
width: number,
|
||||
height: number,
|
||||
uri: string,
|
||||
isStatic: boolean,
|
||||
scale: number,
|
||||
};
|
||||
|
||||
|
@ -125,25 +124,13 @@ function resolveAssetSource(source: any): ?ResolvedAssetSource {
|
|||
|
||||
function assetToImageSource(asset): ResolvedAssetSource {
|
||||
var devServerURL = getDevServerURL();
|
||||
if (devServerURL) {
|
||||
return {
|
||||
__packager_asset: true,
|
||||
width: asset.width,
|
||||
height: asset.height,
|
||||
uri: getPathOnDevserver(devServerURL, asset),
|
||||
isStatic: false,
|
||||
scale: pickScale(asset.scales, PixelRatio.get()),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
__packager_asset: true,
|
||||
width: asset.width,
|
||||
height: asset.height,
|
||||
uri: getPathInArchive(asset),
|
||||
isStatic: true,
|
||||
scale: pickScale(asset.scales, PixelRatio.get()),
|
||||
};
|
||||
}
|
||||
return {
|
||||
__packager_asset: true,
|
||||
width: asset.width,
|
||||
height: asset.height,
|
||||
uri: devServerURL ? getPathOnDevserver(devServerURL, asset) : getPathInArchive(asset),
|
||||
scale: pickScale(asset.scales, PixelRatio.get()),
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = resolveAssetSource;
|
||||
|
|
|
@ -164,7 +164,6 @@ describe('Bundler', function() {
|
|||
|
||||
var imgModule_DEPRECATED = {
|
||||
__packager_asset: true,
|
||||
isStatic: true,
|
||||
path: '/root/img/img.png',
|
||||
uri: 'img',
|
||||
width: 25,
|
||||
|
|
|
@ -263,7 +263,6 @@ class Bundler {
|
|||
]).then(([dimensions, id]) => {
|
||||
const img = {
|
||||
__packager_asset: true,
|
||||
isStatic: true,
|
||||
path: module.path,
|
||||
uri: id.replace(/^[^!]+!/, ''),
|
||||
width: dimensions.width / module.resolution,
|
||||
|
|
Loading…
Reference in New Issue