Revert D5189017: [RN] Native implementation of <Image> intrinsic content size on iOS
Differential Revision: D5189017 fbshipit-source-id: 35901e0b5c289cb7ae5b4fe8b13f3da3e43e819f
@ -33,7 +33,6 @@ class ImageSnapshotTest extends React.Component<{}> {
|
||||
render() {
|
||||
return (
|
||||
<Image
|
||||
style={{position: 'absolute'}}
|
||||
source={require('./blue_square.png')}
|
||||
defaultSource={require('./red_square.png')}
|
||||
onLoad={() => TestModule.verifySnapshot(this.done)} />
|
||||
|
@ -352,11 +352,13 @@ const Image = createReactClass({
|
||||
const source = resolveAssetSource(this.props.source) || { uri: undefined, width: undefined, height: undefined };
|
||||
|
||||
let sources;
|
||||
let style = flattenStyle([styles.base, this.props.style]) || {};
|
||||
let style;
|
||||
if (Array.isArray(source)) {
|
||||
style = flattenStyle([styles.base, this.props.style]) || {};
|
||||
sources = source;
|
||||
} else {
|
||||
const {uri} = source;
|
||||
const {width, height, uri} = source;
|
||||
style = flattenStyle([{width, height}, styles.base, this.props.style]) || {};
|
||||
sources = [source];
|
||||
|
||||
if (uri === '') {
|
||||
|
@ -13,7 +13,6 @@
|
||||
#import <React/RCTConvert.h>
|
||||
#import <React/RCTEventDispatcher.h>
|
||||
#import <React/RCTImageSource.h>
|
||||
#import <React/RCTUIManager.h>
|
||||
#import <React/RCTUtils.h>
|
||||
#import <React/UIView+React.h>
|
||||
|
||||
@ -108,22 +107,6 @@ static NSDictionary *onLoadParamsForSource(RCTImageSource *source)
|
||||
|
||||
RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
|
||||
- (CGSize)intrinsicContentSize
|
||||
{
|
||||
// The first `imageSource` defines intrinsic content size.
|
||||
RCTImageSource *imageSource = _imageSources.firstObject;
|
||||
if (!imageSource) {
|
||||
return CGSizeZero;
|
||||
}
|
||||
|
||||
return imageSource.size;
|
||||
}
|
||||
|
||||
- (void)updateIntrinsicContentSize
|
||||
{
|
||||
[_bridge.uiManager setIntrinsicContentSize:self.intrinsicContentSize forView:self];
|
||||
}
|
||||
|
||||
- (void)updateWithImage:(UIImage *)image
|
||||
{
|
||||
if (!image) {
|
||||
@ -193,7 +176,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
{
|
||||
if (![imageSources isEqual:_imageSources]) {
|
||||
_imageSources = [imageSources copy];
|
||||
[self updateIntrinsicContentSize];
|
||||
_needsReload = YES;
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 164 KiB After Width: | Height: | Size: 166 KiB |
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 165 KiB |
Before Width: | Height: | Size: 164 KiB After Width: | Height: | Size: 166 KiB |
@ -634,18 +634,6 @@ exports.examples = [
|
||||
return <ImageSizeExample source={fullImage} />;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Intrinsic Content Size',
|
||||
description: 'Images have intrinsic content size which respects ' +
|
||||
'to the first `source` image size.',
|
||||
render: function() {
|
||||
return (
|
||||
<View>
|
||||
<Image source={require('./uie_thumb_big.png')} style={{alignSelf: 'center'}} />
|
||||
</View>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'MultipleSourcesExample',
|
||||
description:
|
||||
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |