Skip to content

Commit e0ac660

Browse files
HimanshuHimanshu
authored andcommitted
add ListView
1 parent 6aa4574 commit e0ac660

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

Components/Widgets/List.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'use strict';
33

44
import React from 'react';
5-
import {View} from 'react-native';
5+
import {View, ListView} from 'react-native';
66
import NativeBaseComponent from '../Base/NativeBaseComponent';
77
import computeProps from '../../Utils/computeProps';
88
import _ from 'lodash';
@@ -52,10 +52,21 @@ export default class ListNB extends NativeBaseComponent {
5252
}
5353

5454
render() {
55-
return(
56-
<View {...this.prepareRootProps()} >
57-
{this.renderChildren()}
58-
</View>
59-
);
55+
if(this.props.dataArray && this.props.renderRow) {
56+
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
57+
var dataSource = ds.cloneWithRows(this.props.dataArray);
58+
return (
59+
<ListView {...this.prepareRootProps()}
60+
enableEmptySections={true}
61+
dataSource={dataSource}
62+
renderRow={this.props.renderRow} />
63+
);
64+
}
65+
else
66+
return(
67+
<View {...this.prepareRootProps()} >
68+
{this.renderChildren()}
69+
</View>
70+
);
6071
}
6172
}

0 commit comments

Comments
 (0)