Revert D5189017: [RN] Native implementation of <Image> intrinsic content size on iOS

Differential Revision: D5189017

fbshipit-source-id: 35901e0b5c289cb7ae5b4fe8b13f3da3e43e819f
This commit is contained in:
Valentin Shergin 2017-10-25 08:04:39 -07:00 committed by Facebook Github Bot
parent e118d7a656
commit a32e1cfffb
8 changed files with 4 additions and 33 deletions

View File

@ -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)} />

View File

@ -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 === '') {

View File

@ -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;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 166 KiB

View File

@ -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:

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB