加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

react-native – React Native中的最小宽度/高度

发布时间:2020-12-15 20:55:07 所属栏目:百科 来源:网络整理
导读:如何为React Native组件设置最小宽度或高度? 在css中,我可以使用min-width / min-height https://facebook.github.io/react-native/docs/flexbox.html#content react-native docs上没有minWidth / minHeight 从 iOS和 Android的react-native版本0.29.0开始
如何为React Native组件设置最小宽度或高度?

在css中,我可以使用min-width / min-height

https://facebook.github.io/react-native/docs/flexbox.html#content

react-native docs上没有minWidth / minHeight

从 iOS和 Android的react-native版本0.29.0开始支持minHeight,maxHeight,minWidth和maxWidth属性。

以下是react-native documentation中的maxHeight描述。此描述也适用于其他最小/最大样式属性。

maxHeight is the maximum height for this component,in
logical pixels.

It works similarly to max-height in CSS,but in React Native you must
use points or percentages. Ems and other units are not supported.

See 07003 for
more details.

一个虚拟的例子:

<View
  style={{
    minWidth: '20%',maxWidth: 500,minHeight: '10%',maxHeight: 150,}}
/>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读