@@ -34,9 +34,9 @@ var ScrollResponder = require('ScrollResponder');
34
34
var StaticRenderer = require ( 'StaticRenderer' ) ;
35
35
var TimerMixin = require ( 'react-timer-mixin' ) ;
36
36
37
+ var isEmpty = require ( 'isEmpty' ) ;
37
38
var logError = require ( 'logError' ) ;
38
39
var merge = require ( 'merge' ) ;
39
- var isEmpty = require ( 'isEmpty' ) ;
40
40
41
41
var PropTypes = React . PropTypes ;
42
42
@@ -173,6 +173,13 @@ var ListView = React.createClass({
173
173
* header.
174
174
*/
175
175
renderSectionHeader : PropTypes . func ,
176
+ /**
177
+ * (props) => renderable
178
+ *
179
+ * A function that returns the scrollable component in which the list rows
180
+ * are rendered. Defaults to returning a ScrollView with the given props.
181
+ */
182
+ renderScrollComponent : React . PropTypes . func . isRequired ,
176
183
/**
177
184
* How early to start rendering rows before they come on screen, in
178
185
* pixels.
@@ -228,6 +235,7 @@ var ListView = React.createClass({
228
235
return {
229
236
initialListSize : DEFAULT_INITIAL_ROWS ,
230
237
pageSize : DEFAULT_PAGE_SIZE ,
238
+ renderScrollComponent : props => < ScrollView { ...props } /> ,
231
239
scrollRenderAheadDistance : DEFAULT_SCROLL_RENDER_AHEAD ,
232
240
onEndReachedThreshold : DEFAULT_END_REACHED_THRESHOLD ,
233
241
} ;
@@ -363,23 +371,24 @@ var ListView = React.createClass({
363
371
}
364
372
}
365
373
366
- var props = merge (
367
- this . props , {
368
- onScroll : this . _onScroll ,
369
- stickyHeaderIndices : sectionHeaderIndices ,
370
- }
371
- ) ;
374
+ var {
375
+ renderScrollComponent,
376
+ ...props ,
377
+ } = this . props ;
372
378
if ( ! props . scrollEventThrottle ) {
373
379
props . scrollEventThrottle = DEFAULT_SCROLL_CALLBACK_THROTTLE ;
374
380
}
375
- return (
376
- < ScrollView { ...props }
377
- ref = { SCROLLVIEW_REF } >
378
- { header }
379
- { bodyComponents }
380
- { footer }
381
- </ ScrollView >
382
- ) ;
381
+ Object . assign ( props , {
382
+ onScroll : this . _onScroll ,
383
+ stickyHeaderIndices : sectionHeaderIndices ,
384
+ children : [ header , bodyComponents , footer ] ,
385
+ } ) ;
386
+
387
+ // TODO(ide): Use function refs so we can compose with the scroll
388
+ // component's original ref instead of clobbering it
389
+ return React . cloneElement ( renderScrollComponent ( props ) , {
390
+ ref : SCROLLVIEW_REF ,
391
+ } ) ;
383
392
} ,
384
393
385
394
/**
0 commit comments