gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 07:55:07 25 4
gpt4 key购买 nike

如何为 React Native 组件设置最小宽度或高度?

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

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

react-native 文档上没有 minWidth/minHeight

最佳答案

最小高度 , 最大高度 , 最小宽度 最大宽度 从 react-native 版本 开始支持属性0.29.0 iOSAndroid .

这是最大高度 来自 react-native documentation 的描述.此描述也适用于其他最小/最大样式属性。

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 https://developer.mozilla.org/en-US/docs/Web/CSS/max-height for more details.



一个虚拟示例:

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

关于react-native - React Native 中的最小宽度/高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33427923/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com