Skip to content

Commit

Permalink
Revert D5189017: [RN] Native implementation of <Image> intrinsic cont…
Browse files Browse the repository at this point in the history
…ent size on iOS

Differential Revision: D5189017

fbshipit-source-id: 35901e0b5c289cb7ae5b4fe8b13f3da3e43e819f
  • Loading branch information
shergin authored and facebook-github-bot committed Oct 25, 2017
1 parent e118d7a commit a32e1cf
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 33 deletions.
1 change: 0 additions & 1 deletion IntegrationTests/ImageSnapshotTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)} />
Expand Down
6 changes: 4 additions & 2 deletions Libraries/Image/Image.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 === '') {
Expand Down
18 changes: 0 additions & 18 deletions Libraries/Image/RCTImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -108,22 +107,6 @@ - (void)dealloc

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) {
Expand Down Expand Up @@ -193,7 +176,6 @@ - (void)setImageSources:(NSArray<RCTImageSource *> *)imageSources
{
if (![imageSources isEqual:_imageSources]) {
_imageSources = [imageSources copy];
[self updateIntrinsicContentSize];
_needsReload = YES;
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 0 additions & 12 deletions RNTester/js/ImageExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
File renamed without changes

0 comments on commit a32e1cf

Please sign in to comment.