React-native listview换行

先看看ListView的代码,其布局style为list:
React-native listview换行_第1张图片
布局list才是关键:
React-native listview换行_第2张图片
在list中设置整个ListView的 的宽度为屏幕的宽度(通过Dimendions.get方法来获取),ListView的 contentContainerStyle 里设置的是Item的显示方式,通过flexDirection来设置Item以列(row)的方式渲染出来,然后设置其width属性为跟屏幕一样宽,这样渲染时,每次超过屏幕就会换行

你可能感兴趣的:(React,Native)