使用React-Native在图像周围环绕文本

Tim*_*mvp 8 word-wrap react-native react-native-android

我尝试创建一个带有图像的视图和一个包裹Image组件的Text组件.

我的造型:

  textContainer: {
    flexDirection: 'row',
  },
  text: {
    flex: 10,
  },
  image: {
    flex:1,
    height: 180,
    width: 150,    
    margin: 10,
    borderColor: '#ccc',
    borderWidth: 1,
  }
Run Code Online (Sandbox Code Playgroud)

我的组件:

<ScrollView style={styles.contentContainer} >
   {this.props.content.title_1 ? <Text style={styles.title}>{this.props.content.title_1}</Text> : null}
   <View style={styles.textContainer}>
      {this.props.content.text_1 ? <Text style={styles.text}>{this.props.content.text_1}</Text> : null}
      {this.props.content.image_1 ? <Image width={null} height={null} style={styles.image} source={this.props.content.image_1} /> : null}
   </View>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

这就是结果:(根本没有包装哈哈)

在此输入图像描述

在这里的图片中,我很快将小图片刻录到文本中.但我无法将文字包裹起来..

例

我希望任何人都可以帮助我朝着正确的方向前进!

spo*_*oky 5

这确实很难,但有一种奇怪的方法可以做到这一点......尝试以下方法。它对我有用,但我这样做的地方在其他观点中太深了:

<Text>
  <View style={{width:400, height:100, flex:1, flexDirection:'row'}}>
     <Image source={require('')}/>
     <Text>Your Content Here</Text>
  </View>

</Text>
Run Code Online (Sandbox Code Playgroud)

祝你好运。请发表评论,让我们知道它是否有效。