react-native组件写法

组件基本写法

默认情况下

  1. 组件的 flexDirection 为 列( flexDirection : 'column').
  2. view的默认宽度为100%

组件的默认值



div, span {
box-sizing: border-box;
position: relative;

display: flex;
flex-direction: column;
align-items: stretch;
flex-shrink: 0;

border: 0 solid black;
margin: 0;
padding: 0;
}

参考fb css layout
https://github.com/facebook/css-layout

搜索框

react-native组件写法_第1张图片
Paste_Image.png

代码部分

https://gist.github.com/sherlock221/7035e34cd37ee643bb04


简单的listview

使用简单datasource数据填充方式
https://gist.github.com/sherlock221/7f55e35ed536f51dc7ce


下拉刷新的listview

react-native组件写法_第2张图片
Paste_Image.png

代码:

https://gist.github.com/sherlock221/d0a22cd34964c958a5a6

你可能感兴趣的:(react-native组件写法)