React Native的组件ListView类似于iOS中的UITableView和UICollectionView,也就是说React Native的组件ListView既可以实现UITableView也可以实现UICollectionView。

ListView的使用方法:

1.首先创建一个ListView.DataSource数据源,然后向他传递一个普通的数据源数组。

2.使用该数据源实例化一个ListView组件,定义一个renderRow回调函数,这个函数会接收数组中的每个数据作为参数,并返回一个可以渲染的组件部分。这个组件部分就是ListView的每一行。

  //设置初始值
getInitialState(){
//设置数据源
var ds = new ListView.DataSource({rowHasChanged:(r1,r2) => r1 !== r2}); //当且仅当cell中的任意两行不相等时才重新渲染
//设置返回数据
return{
dataSource:ds.cloneWithRows(Wine)
}
},
render(){
return(
<ListView
dataSource={this.state.dataSource} //数据源
renderRow={this.renderRow} //返回具体的cell,有四个参数 => 1:一条信息 2:分组ID 3:行ID 4:标记是否高亮选中的状态信息.不带()表示参数自传递
/>
);
},

  演示代码如下:

/**
* Sample React Native App
* https://github.com/facebook/react-native
* 周少停 listView
* 2016-09-21
*/

import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
ListView
} from 'react-native';
//导入json数据
var Wine = require('./WineJson.json'); //json数组

var Project = React.createClass({
//设置初始值
getInitialState(){
//设置数据源
var ds = new ListView.DataSource({rowHasChanged:(r1,r2) => r1 !== r2}); //当且仅当cell中的任意两行不相等时才重新渲染
//设置返回数据
return{
dataSource:ds.cloneWithRows(Wine)
}
},
render(){
return(
<ListView
dataSource={this.state.dataSource} //数据源
renderRow={this.renderRow} //返回具体的cell,有四个参数 => 1:一条信息 2:分组ID 3:行ID 4:标记是否高亮选中的状态信息.不带()表示参数自传递
/>
);
},
//返回具体的cell
renderRow(rowData,sectionID,rowID,highlightRow){
return(
<View style={styles.cellViewStyle}>
{/*左边的图片*/}
<Image source={{uri:rowData.image}} style={styles.leftImageStyle} />
{/*右边的View*/}
<View style={styles.rightViewStyle}>
<Text style={styles.nameTextStyle}>{rowData.name}</Text>
<Text style={styles.montyTextStyle}>${rowData.money}</Text>
</View>
</View>
);
}

});

const styles = StyleSheet.create({
cellViewStyle:{
flexDirection:'row',//主轴方向
borderBottomWidth:1,
borderBottomColor:'cyan'
},
leftImageStyle:{
width:60,
height:60
},
rightViewStyle:{

},
nameTextStyle:{

},
montyTextStyle:{
color:'red',
//距底部2
position:'absolute',
bottom:2
}
});

AppRegistry.registerComponent('Project', () => Project);

涉及到的json数据如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
[
    {
        "image":"1.png",
        "money":"319",
        "name":"酒名1"
    },
    {
        "image":"2.png",
        "money":"339",
        "name":"酒名2酒名2酒名2酒名22酒名2酒名酒名2"
    },
    {
        "image":"3.png",
        "money":"319",
        "name":"酒名4"
    },
    {
        "image":"4.png",
        "money":"29",
        "name":"酒名4"
    },
    {
        "image":"5.png",
        "money":"55",
        "name":"酒名5"
    },
    {
        "image":"6.png",
        "money":"67",
        "name":"酒名6"
    },
    {
        "image":"7.png",
        "money":"37",
        "name":"酒名7"
    },
    {
        "image":"8.png",
        "money":"33",
        "name":"酒名8"
    },
    {
        "image":"9.png",
        "money":"35",
        "name":"酒名9"
    },
    {
        "image":"10.png",
        "money":"22",
        "name":"酒名10"
    },
    {
        "image":"11.png",
        "money":"19",
        "name":"酒名11"
    },
    {
        "image":"12.png",
        "money":"392",
        "name":"酒名12"
    },
    {
        "image":"13.png",
        "money":"339",
        "name":"酒名13"
    },
    {
        "image":"14.png",
        "money":"439",
        "name":"酒名14"
    },
    {
        "image":"15.png",
        "money":"359",
        "name":"酒名15"
    },
    {
        "image":"16.png",
        "money":"369",
        "name":"酒名16"
    },
    {
        "image":"17.png",
        "money":"7397",
        "name":"酒名17"
    },
    {
        "image":"18.png",
        "money":"7397",
        "name":"酒名18"
    },
    {
        "image":"19.png",
        "money":"7397",
        "name":"酒名19"
    },
    {
        "image":"20.png",
        "money":"7207",
        "name":"酒名20"
    },
    {
        "image":"21.png",
        "money":"7397",
        "name":"酒名21"
    }
]

效果如下:

九宫格演示:

代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * 周少停 ListView1
 * 2016-09-21
 */
 
import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
    Image,
  ListView,
    AlertIOS,
  TouchableOpacity
} from 'react-native';
//导入json
var shareData= require('./shareJson.json');
//Dimentsions
var Dimensions = require('Dimensions');
var screenWidth = Dimensions.get('window').width;
//一些常量设置
var cols = 3; //一行几个cell
var cellWH = 100; //cell的宽高
var vMargin = (screenWidth - cellWH * cols)/ (cols + 1); //cell之间的边距
var hMargin = 20;
 
var Project = React.createClass({
  //设置默认值(不可修改)
  getDefaultProps(){
    return{
 
    }
  },
  //设置初始值(可以修改)
  getInitialState(){
    var ds = new ListView.DataSource({rowHasChanged:(r1,r2)=> r1 !== r2});
    return{
        dataSource : ds.cloneWithRows(shareData.data)
    }
  },
  render(){
    return(
        <ListView
            dataSource={this.state.dataSource}
            renderRow={this.renderRow}
            contentContainerStyle={styles.listViewStyle}
        />
    );
  },
  //单独的cell
  renderRow(rowData){
    return(
      <TouchableOpacity activeOpacity={0.5} onPress={()=>{this.cellOnclick()}}>
        <View style={styles.innerViewStyle}>
          <Image source={{uri:rowData.icon}} style={styles.iconStyle}/>
          <Text>{rowData.title}</Text>
        </View>
      </TouchableOpacity>
    );
  },
  cellOnclick(){
    AlertIOS.alert("点击了cell")
  }
});
 
const styles = StyleSheet.create({
  listViewStyle:{
      //改变主轴方向
    flexDirection:'row',
    //多行显示
    flexWrap:'wrap'
  },
  innerViewStyle:{
    width:cellWH,
    height:cellWH,
    marginLeft:vMargin,
    marginTop:hMargin,
    alignItems:'center'
  },
  iconStyle :{
    width:80,
    height:80
  }
});
 
AppRegistry.registerComponent('Project', () => Project);

  涉及到的json:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
  "data":[
  {
    "icon":"icon1",
    "title":"分享1"
  },
  {
    "icon":"icon2",
    "title":"分享2"
  },
  {
    "icon":"icon3",
    "title":"分享3"
  },
  {
    "icon":"icon4",
    "title":"分享5"
  },
  {
    "icon":"icon5",
    "title":"分享5"
  },
  {
    "icon":"icon6",
    "title":"分享6"
  },
  {
    "icon":"icon7",
    "title":"分享7"
  },
  {
    "icon":"icon8",
    "title":"分享8"
  },
  {
    "icon":"icon9",
    "title":"分享9"
  },
  {
    "icon":"icon10",
    "title":"分享10"
  }
  ]
  }

  效果如下:

带有表头的listView:

代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * 周少停 ListView
 * 带有分组的ListView 使用cloneWithRowsAndSections设置数据源,三个参数:sectionIDs,rowIDs,dataBlob
 * 2016-09-22
 */
 
import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  Image,
  ListView,
  TouchableOpacity
} from 'react-native';
//导入外部的json数据
var Car = require('./Car.json');
 
var Project = React.createClass({
    //初始化函数 在这里准备数据源
    getInitialState(){
        var sectionData = (dataBlob,sectionID) => {
            return dataBlob[sectionID];
        };
        var rowData = (dataBlob,sectionID,rowID) => {
            return dataBlob[sectionID + ':' + rowID];
        };
        return{
            dataSource:new ListView.DataSource({
                getSectionData:sectionData,
                getRowData:rowData,
                rowHasChanged:(r1,r2) => r1 !== r2,
                sectionHeaderHasChanged:(s1,s2) => s1 !== s2
            })
      }
    },
    render() {
        return (
            <ListView
                dataSource={this.state.dataSource}
                renderRow={this.renderRow}
                renderSectionHeader={this.renderSectionHeader}
            />
        );
    },
    //每一行数据
    renderRow(rowData){
      return(
         <TouchableOpacity activeOpacity={0.5}>
            <View style={styles.rowStyle}>
                <Image source={{uri:rowData.icon}} style={styles.rowImageStyle}/>
                <Text style={{marginLeft: 5}}>{rowData.name}</Text>
            </View>
         </TouchableOpacity>
      );
    },
    //组数据
    renderSectionHeader(sectionData,sectionID){
        return(
            <View style={styles.sectionHeaderStyle}>
                <Text style={{color: 'red',marginLeft:5}}>{sectionData}</Text>
            </View>
        );
    },
    //做一些复杂的操作:数据请求
    componentDidMount() {
        this.loadDataFormJson();
    },
    loadDataFormJson(){
        //先取到data数据
        var jsonData = Car.data;
        //定义一些变量数组用来存值
        var dataBlob = {},sectionIDs = [],rowIDs = [],cars = [];
        //遍历
        for(var i = 0;i<jsonData.length;i++){
           //把组号放入sectionIDs数组中
            sectionIDs.push(i);
            //把组中内容放入dataBlob对象中
            dataBlob[i] = jsonData[i].title;
            //把组中的每行数据的数组放入cars
            cars = jsonData[i].cars;
            //先确定rowIDs的第一维
            rowIDs[i] = [];
            //遍历cars数组,确定rowIDs的第二维
            for(var j = 0;j<cars.length;j++){
                rowIDs[i].push(j);
                //把每一行中的内容放入dataBlob对象中
                dataBlob[i+':'+j] = cars[j];
            }
        }
        this.setState({
           dataSource:this.state.dataSource.cloneWithRowsAndSections(dataBlob,sectionIDs,rowIDs)
        });
    }
});
 
const styles = StyleSheet.create({
    rowImageStyle:{
            width:70,
            height:70
    },
    rowStyle:{
        flexDirection:'row',
        alignItems:'center',
        padding:10,
        borderBottomColor:'#e8e8e8',
        borderBottomWidth:0.5
    },
    sectionHeaderStyle:{
        backgroundColor:'#e8e8e8',
        height:25,
        justifyContent:'center'
    }
});
 
AppRegistry.registerComponent('Project', () => Project);

  涉及到的json:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
{
  "data": [
    {
      "cars": [
        {
          "icon": "m_180_100.png",
          "name": "AC Schnitzer"
        },
        {
          "icon": "m_92_100.png",
          "name": "阿尔法·罗密欧"
        },
        {
          "icon": "m_9_100.png",
          "name": "奥迪"
        },
        {
          "icon": "m_97_100.png",
          "name": "阿斯顿·马丁"
        }
      ],
      "title": "A"
    },
    {
      "cars": [
        {
          "icon": "m_172_100.png",
          "name": "巴博斯"
        },
        {
          "icon": "m_157_100.png",
          "name": "宝骏"
        },
        {
          "icon": "m_3_100.png",
          "name": "宝马"
        },
        {
          "icon": "m_82_100.png",
          "name": "保时捷"
        },
        {
          "icon": "m_163_100.png",
          "name": "北京汽车"
        },
        {
          "icon": "m_211_100.png",
          "name": "北汽幻速"
        },
        {
          "icon": "m_168_100.png",
          "name": "北汽威旺"
        },
        {
          "icon": "m_14_100.png",
          "name": "北汽制造"
        },
        {
          "icon": "m_2_100.png",
          "name": "奔驰"
        },
        {
          "icon": "m_59_100.png",
          "name": "奔腾"
        },
        {
          "icon": "m_26_100.png",
          "name": "本田"
        },
        {
          "icon": "m_5_100.png",
          "name": "标致"
        },
        {
          "icon": "m_127_100.png",
          "name": "别克"
        },
        {
          "icon": "m_85_100.png",
          "name": "宾利"
        },
        {
          "icon": "m_15_100.png",
          "name": "比亚迪"
        },
        {
          "icon": "m_135_100.png",
          "name": "布加迪"
        }
      ],
      "title": "B"
    },
    {
      "cars": [
        {
          "icon": "m_129_100.png",
          "name": "昌河"
        }
      ],
      "title": "C"
    },
    {
      "cars": [
        {
          "icon": "m_113_100.png",
          "name": "道奇"
        },
        {
          "icon": "m_165_100.png",
          "name": "大通"
        },
        {
          "icon": "m_8_100.png",
          "name": "大众"
        },
        {
          "icon": "m_27_100.png",
          "name": "东风"
        },
        {
          "icon": "m_197_100.png",
          "name": "东风风度"
        },
        {
          "icon": "m_141_100.png",
          "name": "东风风神"
        },
        {
          "icon": "m_115_100.png",
          "name": "东风风行"
        },
        {
          "icon": "m_205_100.png",
          "name": "东风小康"
        },
        {
          "icon": "m_29_100.png",
          "name": "东南"
        },
        {
          "icon": "m_179_100.png",
          "name": "DS"
        }
      ],
      "title": "D"
    },
    {
      "cars": [
        {
          "icon": "m_91_100.png",
          "name": "法拉利"
        },
        {
          "icon": "m_199_100.png",
          "name": "飞驰商务车"
        },
        {
          "icon": "m_164_100.png",
          "name": "菲斯克"
        },
        {
          "icon": "m_40_100.png",
          "name": "菲亚特"
        },
        {
          "icon": "m_7_100.png",
          "name": "丰田"
        },
        {
          "icon": "m_67_100.png",
          "name": "福迪"
        },
        {
          "icon": "m_190_100.png",
          "name": "弗那萨利"
        },
        {
          "icon": "m_208_100.png",
          "name": "福汽启腾"
        },
        {
          "icon": "m_17_100.png",
          "name": "福特"
        },
        {
          "icon": "m_128_100.png",
          "name": "福田"
        }
      ],
      "title": "F"
    },
    {
      "cars": [
        {
          "icon": "m_109_100.png",
          "name": "GMC"
        },
        {
          "icon": "m_110_100.png",
          "name": "光冈"
        },
        {
          "icon": "m_147_100.png",
          "name": "广汽"
        },
        {
          "icon": "m_63_100.png",
          "name": "广汽吉奥"
        },
        {
          "icon": "m_133_100.png",
          "name": "广汽日野"
        },
        {
          "icon": "m_182_100.png",
          "name": "观致汽车"
        }
      ],
      "title": "G"
    },
    {
      "cars": [
        {
          "icon": "m_31_100.png",
          "name": "哈飞"
        },
        {
          "icon": "m_196_100.png",
          "name": "哈弗"
        },
        {
          "icon": "m_170_100.png",
          "name": "海格"
        },
        {
          "icon": "m_32_100.png",
          "name": "海马"
        },
        {
          "icon": "m_149_100.png",
          "name": "海马商用车"
        },
        {
          "icon": "m_181_100.png",
          "name": "恒天汽车"
        },
        {
          "icon": "m_58_100.png",
          "name": "红旗"
        },
        {
          "icon": "m_52_100.png",
          "name": "黄海"
        },
        {
          "icon": "m_112_100.png",
          "name": "华泰"
        },
        {
          "icon": "m_45_100.png",
          "name": "汇众"
        }
      ],
      "title": "H"
    },
    {
      "cars": [
        {
          "icon": "m_35_100.png",
          "name": "江淮"
        },
        {
          "icon": "m_37_100.png",
          "name": "江铃"
        },
        {
          "icon": "m_38_100.png",
          "name": "江南"
        },
        {
          "icon": "m_98_100.png",
          "name": "捷豹"
        },
        {
          "icon": "m_143_100.png",
          "name": "吉利帝豪"
        },
        {
          "icon": "m_144_100.png",
          "name": "吉利全球鹰"
        },
        {
          "icon": "m_148_100.png",
          "name": "吉利英伦"
        },
        {
          "icon": "m_39_100.png",
          "name": "金杯"
        },
        {
          "icon": "m_57_100.png",
          "name": "金龙联合"
        },
        {
          "icon": "m_161_100.png",
          "name": "金旅客车"
        },
        {
          "icon": "m_152_100.png",
          "name": "九龙"
        },
        {
          "icon": "m_4_100.png",
          "name": "Jeep"
        }
      ],
      "title": "J"
    },
    {
      "cars": [
        {
          "icon": "m_188_100.png",
          "name": "卡尔森"
        },
        {
          "icon": "m_107_100.png",
          "name": "凯迪拉克"
        },
        {
          "icon": "m_150_100.png",
          "name": "开瑞"
        },
        {
          "icon": "m_51_100.png",
          "name": "克莱斯勒"
        },
        {
          "icon": "m_145_100.png",
          "name": "科尼塞克"
        },
        {
          "icon": "m_212_100.png",
          "name": "KTM"
        }
      ],
      "title": "K"
    },
    {
      "cars": [
        {
          "icon": "m_86_100.png",
          "name": "兰博基尼"
        },
        {
          "icon": "m_200_100.png",
          "name": "蓝海房车"
        },
        {
          "icon": "m_80_100.png",
          "name": "劳斯莱斯"
        },
        {
          "icon": "m_94_100.png",
          "name": "雷克萨斯"
        },
        {
          "icon": "m_99_100.png",
          "name": "雷诺"
        },
        {
          "icon": "m_146_100.png",
          "name": "莲花"
        },
        {
          "icon": "m_153_100.png",
          "name": "猎豹汽车"
        },
        {
          "icon": "m_76_100.png",
          "name": "力帆"
        },
        {
          "icon": "m_16_100.png",
          "name": "铃木"
        },
        {
          "icon": "m_166_100.png",
          "name": "理念"
        },
        {
          "icon": "m_95_100.png",
          "name": "林肯"
        },
        {
          "icon": "m_36_100.png",
          "name": "陆风"
        },
        {
          "icon": "m_96_100.png",
          "name": "路虎"
        },
        {
          "icon": "m_83_100.png",
          "name": "路特斯"
        }
      ],
      "title": "L"
    },
    {
      "cars": [
        {
          "icon": "m_183_100.png",
          "name": "迈凯伦"
        },
        {
          "icon": "m_93_100.png",
          "name": "玛莎拉蒂"
        },
        {
          "icon": "m_18_100.png",
          "name": "马自达"
        },
        {
          "icon": "m_79_100.png",
          "name": "MG"
        },
        {
          "icon": "m_81_100.png",
          "name": "MINI"
        },
        {
          "icon": "m_201_100.png",
          "name": "摩根"
        }
      ],
      "title": "M"
    },
    {
      "cars": [
        {
          "icon": "m_155_100.png",
          "name": "纳智捷"
        }
      ],
      "title": "N"
    },
    {
      "cars": [
        {
          "icon": "m_104_100.png",
          "name": "欧宝"
        },
        {
          "icon": "m_84_100.png",
          "name": "讴歌"
        },
        {
          "icon": "m_171_100.png",
          "name": "欧朗"
        }
      ],
      "title": "O"
    },
    {
      "cars": [
        {
          "icon": "m_156_100.png",
          "name": "启辰"
        },
        {
          "icon": "m_43_100.png",
          "name": "庆铃"
        },
        {
          "icon": "m_42_100.png",
          "name": "奇瑞"
        },
        {
          "icon": "m_28_100.png",
          "name": "起亚"
        }
      ],
      "title": "Q"
    },
    {
      "cars": [
        {
          "icon": "m_30_100.png",
          "name": "日产"
        },
        {
          "icon": "m_78_100.png",
          "name": "荣威"
        },
        {
          "icon": "m_142_100.png",
          "name": "瑞麒"
        }
      ],
      "title": "R"
    },
    {
      "cars": [
        {
          "icon": "m_25_100.png",
          "name": "三菱"
        },
        {
          "icon": "m_209_100.png",
          "name": "山姆"
        },
        {
          "icon": "m_195_100.png",
          "name": "绅宝"
        },
        {
          "icon": "m_50_100.png",
          "name": "双环"
        },
        {
          "icon": "m_102_100.png",
          "name": "双龙"
        },
        {
          "icon": "m_111_100.png",
          "name": "斯巴鲁"
        },
        {
          "icon": "m_10_100.png",
          "name": "斯柯达"
        },
        {
          "icon": "m_89_100.png",
          "name": "smart"
        }
      ],
      "title": "S"
    },
    {
      "cars": [
        {
          "icon": "m_202_100.png",
          "name": "泰卡特"
        },
        {
          "icon": "m_189_100.png",
          "name": "特斯拉"
        }
      ],
      "title": "T"
    },
    {
      "cars": [
        {
          "icon": "m_140_100.png",
          "name": "威麟"
        },
        {
          "icon": "m_186_100.png",
          "name": "威兹曼"
        },
        {
          "icon": "m_19_100.png",
          "name": "沃尔沃"
        },
        {
          "icon": "m_48_100.png",
          "name": "五菱"
        }
      ],
      "title": "W"
    },
    {
      "cars": [
        {
          "icon": "m_13_100.png",
          "name": "现代"
        },
        {
          "icon": "m_174_100.png",
          "name": "星客特"
        },
        {
          "icon": "m_71_100.png",
          "name": "新凯"
        },
        {
          "icon": "m_87_100.png",
          "name": "西雅特"
        },
        {
          "icon": "m_49_100.png",
          "name": "雪佛兰"
        },
        {
          "icon": "m_6_100.png",
          "name": "雪铁龙"
        }
      ],
      "title": "X"
    },
    {
      "cars": [
        {
          "icon": "m_194_100.png",
          "name": "扬州亚星客车"
        },
        {
          "icon": "m_138_100.png",
          "name": "野马汽车"
        },
        {
          "icon": "m_100_100.png",
          "name": "英菲尼迪"
        },
        {
          "icon": "m_53_100.png",
          "name": "一汽"
        },
        {
          "icon": "m_41_100.png",
          "name": "依维柯"
        },
        {
          "icon": "m_75_100.png",
          "name": "永源"
        }
      ],
      "title": "Y"
    },
    {
      "cars": [
        {
          "icon": "m_136_100.png",
          "name": "长安轿车"
        },
        {
          "icon": "m_159_100.png",
          "name": "长安商用"
        },
        {
          "icon": "m_21_100.png",
          "name": "长城"
        },
        {
          "icon": "m_203_100.png",
          "name": "之诺"
        },
        {
          "icon": "m_60_100.png",
          "name": "中华"
        },
        {
          "icon": "m_167_100.png",
          "name": "中欧"
        },
        {
          "icon": "m_77_100.png",
          "name": "众泰"
        },
        {
          "icon": "m_204_100.png",
          "name": "中通客车"
        },
        {
          "icon": "m_33_100.png",
          "name": "中兴"
        }
      ],
      "title": "Z"
    }
  ]
}

  效果如下:

 

  完整源码下载:https://github.com/pheromone/React-Native-1