React Native图标与文本内联

4

您好,我想实现以下样式:

输入图像描述

但是使用下面的代码,我得到一个独立列的图标和另一个列的文本:

<View style={{flex:1, flexDirection:'row'}}>
  <Icon height={10} width={10} />
  <Text>It is a long established fact that a reader will be distracted by the readable 
    content of a page when looking at its layout. The point of using Lorem Ipsum is that it 
    has a more-or-less normal distribution of letters, as opposed to using 'Content here, 
    content here'
</Text>
</View>

在此输入图片描述

请忽略不同的图标。 这个问题有什么解决办法吗?

1个回答

6
实际上,您可以将图标嵌入文本中,像这样:

<View style={{flex:1, flexDirection:'row'}}>
  <Text>
    <Icon height={10} width={10} />
    It is a long established fact that a reader will be distracted by the readable 
    content of a page when looking at its layout. The point of using Lorem Ipsum is that it 
    has a more-or-less normal distribution of letters, as opposed to using 
    'Content here, content here'
  </Text>
</View>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接