Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there anyway to embed image in <Text> in react-native

Tags:

react-native

Someone may want to implement a richtext edit or richtext view. In html we can do it with inline image tag, but react-native Text can only nest Text in it.

like image 743
Naryc Avatar asked Dec 30 '15 15:12

Naryc


1 Answers

Here's a workaround that'll preserve styles

<View style={{flexDirection:'row', flexWrap:'wrap'}}>
    <Image
        style={styles.img}
        source={{uri: imageLink}} />
    <Text>
        {"sweet, this works"}
    </Text>
</View>
like image 140
Ricky Sahu Avatar answered Sep 29 '22 08:09

Ricky Sahu