Initial checkin for Image within Text nodes

Summary: This adds the basic support for embedding an image in a TextView.

Implementation details :

We create a ReactTextInlineImageShadowNode whenever an Image is embedded within a Text context.
That uses the same parsing code as ReactImageView (copied, not shared) to parse the source property to figure out the Uri where the resource is.

In ReactTextShadowNode we now look for the ReactTextInlineImageShadowNode and place a TextInlineImageSpan so that we can layout appropriately

Later at the time we go to setText on the TextView, we update that TextInlineImageSpan so that the proper Drawable (downloaded via Fresco) can be shown

public

Reviewed By: mkonicek

Differential Revision: D2652667

fb-gh-sync-id: 8f24924d204f78b8bc4d5d67835cc73b3c1859dd
This commit is contained in:
Dave Miller
2015-11-13 10:51:09 -08:00
committed by facebook-github-bot-0
parent 492412f177
commit a0268a7bfc
13 changed files with 544 additions and 20 deletions

View File

@@ -17,6 +17,7 @@
var React = require('react-native');
var {
Image,
StyleSheet,
Text,
View,
@@ -359,6 +360,11 @@ var TextExample = React.createClass({
No maximum lines specified no matter now much I write here. If I keep writing it{"'"}ll just keep going and going
</Text>
</UIExplorerBlock>
<UIExplorerBlock title="Inline images">
<Text>
This text contains an inline image <Image source={require('./flux.png')}/>. Neat, huh?
</Text>
</UIExplorerBlock>
</UIExplorerPage>
);
}