Added support for width & height for text images

Summary:
public

Previously, `<Image>` elements embedded inside `<Text>` ignored all style attributes and props apart from `source`. Now, the `width`, `height` and `resizeMode` styles are observed. I've also added a transparent placeholder to be displayed while the image is loading, to prevent the layout from changing after the image has loaded.

Reviewed By: javache

Differential Revision: D2838659

fb-gh-sync-id: c27f9685b6976705ac2b24075922b2bf247e06ba
This commit is contained in:
Nick Lockwood
2016-01-22 11:31:40 -08:00
committed by facebook-github-bot-4
parent f20453baee
commit 2cbc912756
9 changed files with 160 additions and 43 deletions

View File

@@ -213,8 +213,6 @@ static css_dim_t RCTMeasure(void *context, float width, float height)
NSTextAttachment *imageAttachment = [NSTextAttachment new];
imageAttachment.image = image;
[attributedString appendAttributedString:[NSAttributedString attributedStringWithAttachment:imageAttachment]];
} else {
//TODO: add placeholder image?
}
} else {
RCTLogError(@"<Text> can't have any children except <Text>, <Image> or raw strings");