[fix] ListView child layout

Fix #166
This commit is contained in:
Nicolas Gallagher
2016-07-12 21:18:18 -07:00
parent 0f8cff6124
commit 249f157ed9
2 changed files with 7 additions and 8 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
[![Build Status][travis-image]][travis-url]
[![npm version][npm-image]][npm-url]
![gzipped size](https://img.shields.io/badge/gzipped-~41.0k-blue.svg)
![gzipped size](https://img.shields.io/badge/gzipped-~48.6k-blue.svg)
[React Native][react-native-url] components and APIs for the Web.
+6 -7
View File
@@ -3,6 +3,8 @@ import React, { Component } from 'react'
import ScrollView from '../ScrollView'
import ListViewDataSource from './ListViewDataSource'
import ListViewPropTypes from './ListViewPropTypes'
import View from '../View'
import pick from 'lodash/pick'
const SCROLLVIEW_REF = 'listviewscroll'
@@ -64,7 +66,7 @@ class ListView extends Component {
if (renderSectionHeader) {
const section = dataSource.getSectionHeaderData(sectionIdx)
const key = 's_' + sectionId
const child = <div key={key}>{renderSectionHeader(section, sectionId)}</div>
const child = <View key={key}>{renderSectionHeader(section, sectionId)}</View>
children.push(child)
}
@@ -73,7 +75,7 @@ class ListView extends Component {
const rowId = rows[rowIdx]
const row = dataSource.getRowData(sectionIdx, rowIdx)
const key = 'r_' + sectionId + '_' + rowId
const child = <div key={key}>{renderRow(row, sectionId, rowId, this.onRowHighlighted)}</div>
const child = <View key={key}>{renderRow(row, sectionId, rowId, this.onRowHighlighted)}</View>
children.push(child)
// render optional separator
@@ -88,12 +90,9 @@ class ListView extends Component {
}
}
const {
renderScrollComponent,
...props
} = this.props
const props = pick(ScrollView.propTypes, this.props)
return React.cloneElement(renderScrollComponent(props), {
return React.cloneElement(this.props.renderScrollComponent(props), {
ref: SCROLLVIEW_REF
}, header, children, footer)
}