@@ -41,7 +41,8 @@ const IPropTypes = {
41
41
renderForeground : func ,
42
42
renderScrollComponent : func ,
43
43
renderStickyHeader : func ,
44
- stickyHeaderHeight : number
44
+ stickyHeaderHeight : number ,
45
+ contentContainerStyle : View . propTypes . style
45
46
} ;
46
47
47
48
class ParallaxScrollView extends Component {
@@ -79,12 +80,13 @@ class ParallaxScrollView extends Component {
79
80
renderStickyHeader,
80
81
stickyHeaderHeight,
81
82
style,
83
+ contentContainerStyle,
82
84
...scrollViewProps
83
85
} = this . props ;
84
86
85
87
const background = this . _renderBackground ( { fadeOutBackground, backgroundScrollSpeed, backgroundColor, parallaxHeaderHeight, stickyHeaderHeight, renderBackground } ) ;
86
88
const foreground = this . _renderForeground ( { fadeOutForeground, parallaxHeaderHeight, stickyHeaderHeight, renderForeground : renderForeground || renderParallaxHeader } ) ;
87
- const bodyComponent = this . _wrapChildren ( children , { contentBackgroundColor, stickyHeaderHeight } ) ;
89
+ const bodyComponent = this . _wrapChildren ( children , { contentBackgroundColor, stickyHeaderHeight, contentContainerStyle } ) ;
88
90
const footerSpacer = this . _renderFooterSpacer ( { contentBackgroundColor } ) ;
89
91
const maybeStickyHeader = this . _maybeRenderStickyHeader ( { parallaxHeaderHeight, stickyHeaderHeight, backgroundColor, renderFixedHeader, renderStickyHeader } ) ;
90
92
const scrollElement = renderScrollComponent ( scrollViewProps ) ;
@@ -240,11 +242,16 @@ class ParallaxScrollView extends Component {
240
242
) ;
241
243
}
242
244
243
- _wrapChildren ( children , { contentBackgroundColor, stickyHeaderHeight } ) {
245
+ _wrapChildren ( children , { contentBackgroundColor, stickyHeaderHeight, contentContainerStyle } ) {
244
246
const { viewHeight } = this . state ;
247
+ const containerStyles = [ { backgroundColor : contentBackgroundColor } ] ;
248
+
249
+ if ( contentContainerStyle )
250
+ containerStyles . push ( contentContainerStyle ) ;
251
+
245
252
return (
246
253
< View
247
- style = { { backgroundColor : contentBackgroundColor } }
254
+ style = { containerStyles }
248
255
onLayout = { e => {
249
256
// Adjust the bottom height so we can scroll the parallax header all the way up.
250
257
const { nativeEvent : { layout : { height } } } = e ;
@@ -321,7 +328,8 @@ ParallaxScrollView.defaultProps = {
321
328
renderBackground : renderEmpty ,
322
329
renderParallaxHeader : renderEmpty , // Deprecated (will be removed in 0.18.0)
323
330
renderForeground : null ,
324
- stickyHeaderHeight : 0
331
+ stickyHeaderHeight : 0 ,
332
+ contentContainerStyle : null
325
333
} ;
326
334
327
335
module . exports = ParallaxScrollView ;
0 commit comments