如何在本机反应中在图像周围浮动文本 [英] How to float text around image in react native

查看:25
本文介绍了如何在本机反应中在图像周围浮动文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在使文本环绕图像的本机反应中实现非常常见的效果.在 Web 上,您可以为图像分配一个 float 属性,并在其后面添加一个 p 标签..

这是我一直在研究的

I am trying to achieve a very common effect in react native of having text wrap around an image. On the web you would assign a float property to the image and follow it with a p tag. .

Here is a RNPlay example I've been working on. I think the method I currently have is a bit hackish, and doesn't properly work since the text does not align with the top of the image and flow down. Is there a proper and clean way to accomplish this?

解决方案

You can use a Text as container instead of the typical 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>

这篇关于如何在本机反应中在图像周围浮动文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆