我正在尝试实现一种非常常见的效果,即让文本环绕图像。在 Web 上,您可以为图像分配一个 float
属性,然后在它后面加上一个 p
标签。 .
这是一个RNPlay example我一直在努力。我认为我目前使用的方法有点老套,而且不能正常工作,因为文本没有与图像顶部对齐并向下流动。是否有适当且干净的方法来完成此操作?
最佳答案
您可以使用 Text
作为容器而不是典型的 View
。
<Text style={{flex: 1}}>
<Image source={Images.IconExplore} style={{ width: 16, height: 16 }} />
<Text> Your past has been in control for far too long. It's time to shift to a higher expression of what you are capable of so you can create the life you want to live.</Text>
</Text>
关于css - 如何在 React Native 中使文本在图像周围 float ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39514335/