Make list use data/render model

This commit is contained in:
John Lyon-Smith
2018-03-19 08:05:48 -07:00
parent bfd86b5b46
commit 59c11d791d
2 changed files with 10 additions and 14 deletions

View File

@@ -6,13 +6,12 @@ import { sizeInfo, colorInfo, fontInfo } from './style'
class List extends Component {
static propTypes = {
children: PropTypes.node,
// data: PropTypes.array,
// render: PropTypes.func,
data: PropTypes.array,
render: PropTypes.func.isRequired,
}
render() {
const { children } = this.props
const { data, render } = this.props
return (
<Box
@@ -24,7 +23,7 @@ class List extends Component {
fontFamily: fontInfo.family,
overflow: 'scroll',
}}>
{children}
{data ? data.map(render) : null}
</Box>
)
}