@@ -24,6 +24,7 @@ const IPropTypes = {
24
24
backgroundColor : string ,
25
25
backgroundScrollSpeed : number ,
26
26
fadeOutForeground : bool ,
27
+ fadeOutBackground : bool ,
27
28
contentBackgroundColor : string ,
28
29
onChangeHeaderVisibility : func ,
29
30
parallaxHeaderHeight : number . isRequired ,
@@ -60,6 +61,7 @@ class ParallaxScrollView extends Component {
60
61
children,
61
62
contentBackgroundColor,
62
63
fadeOutForeground,
64
+ fadeOutBackground,
63
65
parallaxHeaderHeight,
64
66
renderBackground,
65
67
renderFixedHeader,
@@ -72,7 +74,7 @@ class ParallaxScrollView extends Component {
72
74
...scrollViewProps
73
75
} = this . props ;
74
76
75
- const background = this . _renderBackground ( { backgroundScrollSpeed, backgroundColor, parallaxHeaderHeight, stickyHeaderHeight, renderBackground } ) ;
77
+ const background = this . _renderBackground ( { fadeOutBackground , backgroundScrollSpeed, backgroundColor, parallaxHeaderHeight, stickyHeaderHeight, renderBackground } ) ;
76
78
const foreground = this . _renderForeground ( { fadeOutForeground, parallaxHeaderHeight, stickyHeaderHeight, renderForeground : renderForeground || renderParallaxHeader } ) ;
77
79
const bodyComponent = this . _wrapChildren ( children , { contentBackgroundColor, stickyHeaderHeight } ) ;
78
80
const footerSpacer = this . _renderFooterSpacer ( { contentBackgroundColor } ) ;
@@ -168,7 +170,7 @@ class ParallaxScrollView extends Component {
168
170
}
169
171
}
170
172
171
- _renderBackground ( { backgroundScrollSpeed, backgroundColor, parallaxHeaderHeight, stickyHeaderHeight, renderBackground } ) {
173
+ _renderBackground ( { fadeOutBackground , backgroundScrollSpeed, backgroundColor, parallaxHeaderHeight, stickyHeaderHeight, renderBackground } ) {
172
174
const { viewWidth, viewHeight, scrollY } = this . state ;
173
175
const p = pivotPoint ( parallaxHeaderHeight , stickyHeaderHeight ) ;
174
176
return (
@@ -177,6 +179,13 @@ class ParallaxScrollView extends Component {
177
179
backgroundColor : backgroundColor ,
178
180
height : parallaxHeaderHeight ,
179
181
width : viewWidth ,
182
+ opacity : fadeOutBackground
183
+ ? scrollY . interpolate ( {
184
+ inputRange : [ 0 , p * ( 1 / 2 ) , p * ( 3 / 4 ) , p ] ,
185
+ outputRange : [ 1 , 0.3 , 0.1 , 0 ] ,
186
+ extrapolate : 'clamp'
187
+ } )
188
+ : 1 ,
180
189
transform : [ {
181
190
translateY : scrollY . interpolate ( {
182
191
inputRange : [ 0 , p ] ,
0 commit comments