forked from GeekyAnts/NativeBase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathList.js
More file actions
33 lines (28 loc) · 862 Bytes
/
List.js
File metadata and controls
33 lines (28 loc) · 862 Bytes
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
import { connectStyle } from 'native-base-shoutem-theme';
import React, { Component } from 'react';
import { FlatList, View } from 'react-native';
import mapPropsToStyleNames from '../utils/mapPropsToStyleNames';
class List extends Component {
render() {
const { dataArray } = this.props;
if (dataArray) {
return (
<FlatList
ref={ref => (this._root = ref)}
data={dataArray}
renderItem={({ item, index }) =>
this.props.renderItem
? this.props.renderItem({ item, index })
: this.props.renderRow(item, 0, index)
}
{...this.props}
/>
);
}
return <View ref={c => (this._root = c)} {...this.props} />;
}
}
const StyledList = connectStyle('NativeBase.List', {}, mapPropsToStyleNames)(
List
);
export { StyledList as List };