美文网首页
React-Native 布局

React-Native 布局

作者: 3faae5c7a9a7 | 来源:发表于2017-08-07 21:41 被阅读0次

第一次尝试些博客,目的有二:1、旨在督促自己,养成好的学习习惯;2、将自己的学习经验与网上的各路大神分享,求得共同进步; 

最近在学习react-native,页面布局是最重要的基础,以下为布局总结:

在RN中主要通过flex_box布局,组件布局属性:

position:  relative,absolute

top buttom left right  width height maxHeight maxWidth minHeight minWidth 

子组件布局属性

flexDirection: row、column(默认)、row-reverse、column-reverse  (主轴方向)

flexWrap: 当子组件按照flexDirection排列,超出屏幕范围时的处理方式:wrap(自动换行)、nowrap;

justifyContent:定义在给定方向上子组件的排列方式:flex-start、flex-end、center、space-between、space-around(首尾空白)

alignItems:定义子组件的对齐规则,flex-start、flex-end、center、stretch;

flex:1 子组件自动缩放以适应父组件剩下的空白空间;

alignSelf:通过设置此值,可以使子组件忽略父组件alignItems的布局设置,可取:auto\flex-start\flex-end\stretch;

padding\border\margin

相关文章

网友评论

      本文标题:React-Native 布局

      本文链接:https://www.haomeiwen.com/subject/zzwtsttx.html