reactjs - React Native:弹性与高度
问题描述
我是 React Native 的新手。
我看到了一个类似的问题,但它没有回答我在寻找什么。
我的问题是,有什么区别(性能,行为):
<View style={{ flex: 1, background: 'blue' }}>
<Text style={{ flex: 0.8, background: 'red' }}>Hello</Text>
<Text style={{ flex: 0.2, background: 'brown' }}>World</Text>
</View>
和
<View style={{ height: '100%', background: 'blue' }}>
<Text style={{ height: '80%', background: 'red' }}>Hello</Text>
<Text style={{ height: '20%', background: 'brown' }}>World</Text>
</View>
因为我看不出使用两者有什么区别。
解决方案
查看这篇文章 - 它与响应能力有关,而不是像素百分比。React Native:高度与弹性
推荐阅读
- elasticsearch - 在elasticsearch中通过嵌套字段值的总和查询文档
- python - tf.reshape 在添加额外维度的情况下不起作用
- ios - 将框架弱链接到静态库
- php - 为什么我的支付墙 pingback 没有更新数据库,并且我在 pingback 测试中收到错误?
- swift - 可编码结构:按键获取值
- php - 我的错误处理程序不应该返回 false
- java - 与 DAO 模式的对称关系
- matlab - 在每个非空白图像之后显示空白图像
- c - 我可以编写一个可以在 C 中返回一种数据类型或另一种数据类型的函数吗?
- ckeditor - 在 CKEditor5 中更改视图模式的优雅方法