@@ -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
@@ -163,6 +163,13 @@ var ListView = React.createClass({
163
163
* header.
164
164
*/
165
165
renderSectionHeader : PropTypes . func ,
166
+ /**
167
+ * (props) => renderable
168
+ *
169
+ * A function that returns the scroll view in which the list rows are
170
+ * rendered. Defaults to returning a ScrollView with the given props.
171
+ */
172
+ renderScrollView : React . PropTypes . func . isRequired ,
166
173
/**
167
174
* How early to start rendering rows before they come on screen, in
168
175
* pixels.
@@ -218,6 +225,7 @@ var ListView = React.createClass({
218
225
return {
219
226
initialListSize : DEFAULT_INITIAL_ROWS ,
220
227
pageSize : DEFAULT_PAGE_SIZE ,
228
+ renderScrollView : ( props ) => < ScrollView { ...props } /> ,
221
229
scrollRenderAheadDistance : DEFAULT_SCROLL_RENDER_AHEAD ,
222
230
onEndReachedThreshold : DEFAULT_END_REACHED_THRESHOLD ,
223
231
} ;
@@ -319,24 +327,22 @@ var ListView = React.createClass({
319
327
}
320
328
}
321
329
322
- var props = merge (
323
- this . props , {
324
- onScroll : this . _onScroll ,
325
- stickyHeaderIndices : sectionHeaderIndices ,
326
- }
327
- ) ;
330
+ var {
331
+ renderScrollView,
332
+ ...props ,
333
+ } = this . props ;
328
334
if ( ! props . scrollEventThrottle ) {
329
335
props . scrollEventThrottle = DEFAULT_SCROLL_CALLBACK_THROTTLE ;
330
336
}
337
+ Object . assign ( props , {
338
+ onScroll : this . _onScroll ,
339
+ stickyHeaderIndices : sectionHeaderIndices ,
340
+ children : [ header , bodyComponents , footer ] ,
341
+ } ) ;
331
342
332
- return (
333
- < ScrollView { ...props }
334
- ref = { SCROLLVIEW_REF } >
335
- { header }
336
- { bodyComponents }
337
- { footer }
338
- </ ScrollView >
339
- ) ;
343
+ return React . cloneElement ( renderScrollView ( props ) , {
344
+ ref : SCROLLVIEW_REF ,
345
+ } ) ;
340
346
} ,
341
347
342
348
/**
0 commit comments