Skip to content

Commit a32e1cf

Browse files
sherginfacebook-github-bot
authored andcommitted
Revert D5189017: [RN] Native implementation of <Image> intrinsic content size on iOS
Differential Revision: D5189017 fbshipit-source-id: 35901e0b5c289cb7ae5b4fe8b13f3da3e43e819f
1 parent e118d7a commit a32e1cf

File tree

8 files changed

+4
-33
lines changed

8 files changed

+4
-33
lines changed

IntegrationTests/ImageSnapshotTest.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class ImageSnapshotTest extends React.Component<{}> {
3333
render() {
3434
return (
3535
<Image
36-
style={{position: 'absolute'}}
3736
source={require('./blue_square.png')}
3837
defaultSource={require('./red_square.png')}
3938
onLoad={() => TestModule.verifySnapshot(this.done)} />

Libraries/Image/Image.ios.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,13 @@ const Image = createReactClass({
352352
const source = resolveAssetSource(this.props.source) || { uri: undefined, width: undefined, height: undefined };
353353

354354
let sources;
355-
let style = flattenStyle([styles.base, this.props.style]) || {};
355+
let style;
356356
if (Array.isArray(source)) {
357+
style = flattenStyle([styles.base, this.props.style]) || {};
357358
sources = source;
358359
} else {
359-
const {uri} = source;
360+
const {width, height, uri} = source;
361+
style = flattenStyle([{width, height}, styles.base, this.props.style]) || {};
360362
sources = [source];
361363

362364
if (uri === '') {

Libraries/Image/RCTImageView.m

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#import <React/RCTConvert.h>
1414
#import <React/RCTEventDispatcher.h>
1515
#import <React/RCTImageSource.h>
16-
#import <React/RCTUIManager.h>
1716
#import <React/RCTUtils.h>
1817
#import <React/UIView+React.h>
1918

@@ -108,22 +107,6 @@ - (void)dealloc
108107

109108
RCT_NOT_IMPLEMENTED(- (instancetype)init)
110109

111-
- (CGSize)intrinsicContentSize
112-
{
113-
// The first `imageSource` defines intrinsic content size.
114-
RCTImageSource *imageSource = _imageSources.firstObject;
115-
if (!imageSource) {
116-
return CGSizeZero;
117-
}
118-
119-
return imageSource.size;
120-
}
121-
122-
- (void)updateIntrinsicContentSize
123-
{
124-
[_bridge.uiManager setIntrinsicContentSize:self.intrinsicContentSize forView:self];
125-
}
126-
127110
- (void)updateWithImage:(UIImage *)image
128111
{
129112
if (!image) {
@@ -193,7 +176,6 @@ - (void)setImageSources:(NSArray<RCTImageSource *> *)imageSources
193176
{
194177
if (![imageSources isEqual:_imageSources]) {
195178
_imageSources = [imageSources copy];
196-
[self updateIntrinsicContentSize];
197179
_needsReload = YES;
198180
}
199181
}
1.93 KB
Loading
1.92 KB
Loading
1.92 KB
Loading

RNTester/js/ImageExample.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -634,18 +634,6 @@ exports.examples = [
634634
return <ImageSizeExample source={fullImage} />;
635635
},
636636
},
637-
{
638-
title: 'Intrinsic Content Size',
639-
description: 'Images have intrinsic content size which respects ' +
640-
'to the first `source` image size.',
641-
render: function() {
642-
return (
643-
<View>
644-
<Image source={require('./uie_thumb_big.png')} style={{alignSelf: 'center'}} />
645-
</View>
646-
);
647-
},
648-
},
649637
{
650638
title: 'MultipleSourcesExample',
651639
description:

0 commit comments

Comments
 (0)