React Native 如何包装内容视图 [英] React native how to wrap content view

查看:40
本文介绍了React Native 如何包装内容视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 RN 很陌生,反正有没有包装视图的内容,类似于 Android.在 Android 中我可以调整,Height: 'wrap-content',但在 RN 中,我不能做任何环绕内容.

I'm pretty new with RN, is there anyway to wrap the content of the view, similar to Android. In Android I can adjust, Height: 'wrap-content', but somehow in RN, I can't do any wrap content.

要么是我设置了视图的高度,要么只是 flex,但仍然没有包裹视图.

It's either I set the height of the view, or just flex, but still not wrap the view.

推荐答案

你可以像这样设置父组件来包裹子组件.

You can set the parent to wrap child component like this.

alignSelf: '基线'

alignSelf: 'baseline'

<View style={{ alignSelf:'baseline'}}>
  <Text>Child Content</Text>
</View>

水平包装子内容.

这篇关于React Native 如何包装内容视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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