@@ -222,14 +222,14 @@ class ParallaxScrollView extends Component {
222
222
}
223
223
224
224
_renderBackground ( {
225
- fadeOutBackground,
226
- backgroundScrollSpeed,
227
- backgroundColor,
228
- parallaxHeaderHeight,
229
- stickyHeaderHeight,
230
- renderBackground,
231
- outputScaleValue
232
- } ) {
225
+ fadeOutBackground,
226
+ backgroundScrollSpeed,
227
+ backgroundColor,
228
+ parallaxHeaderHeight,
229
+ stickyHeaderHeight,
230
+ renderBackground,
231
+ outputScaleValue
232
+ } ) {
233
233
const { viewWidth, viewHeight } = this . state
234
234
const { scrollY } = this
235
235
const p = pivotPoint ( parallaxHeaderHeight , stickyHeaderHeight )
@@ -276,35 +276,55 @@ class ParallaxScrollView extends Component {
276
276
}
277
277
278
278
_renderForeground ( {
279
- fadeOutForeground,
280
- parallaxHeaderHeight,
281
- stickyHeaderHeight,
282
- renderForeground
283
- } ) {
279
+ fadeOutForeground,
280
+ parallaxHeaderHeight,
281
+ stickyHeaderHeight,
282
+ renderForeground
283
+ } ) {
284
+ const { viewWidth, viewHeight } = this . state
284
285
const { scrollY } = this
285
286
const p = pivotPoint ( parallaxHeaderHeight , stickyHeaderHeight )
286
287
return (
287
- < View style = { styles . parallaxHeaderContainer } >
288
- < Animated . View
289
- style = { [
290
- styles . parallaxHeader ,
291
- {
292
- height : parallaxHeaderHeight ,
293
- opacity : fadeOutForeground
294
- ? interpolate ( scrollY , {
295
- inputRange : [ 0 , p * ( 1 / 2 ) , p * ( 3 / 4 ) , p ] ,
296
- outputRange : [ 1 , 0.3 , 0.1 , 0 ] ,
288
+
289
+ < Animated . View
290
+ style = { [
291
+ styles . parallaxHeader ,
292
+ {
293
+ backgroundColor : 'white' ,
294
+ height : parallaxHeaderHeight ,
295
+ width : viewWidth ,
296
+ opacity : fadeOutForeground
297
+ ? interpolate ( scrollY , {
298
+ inputRange : [ 0 , p * ( 1 / 2 ) , p * ( 3 / 4 ) , p ] ,
299
+ outputRange : [ 1 , 0.3 , 0.1 , 0 ] ,
300
+ extrapolate : 'clamp'
301
+ } )
302
+ : 1 ,
303
+ transform : [
304
+ {
305
+ translateY : interpolate ( scrollY , {
306
+ inputRange : [ 0 , p ] ,
307
+ outputRange : [ 0 , - ( p / 100 ) ] ,
308
+ extrapolateRight : 'extend' ,
309
+ extrapolateLeft : 'clamp'
310
+ } )
311
+ } ,
312
+ {
313
+ scale : interpolate ( scrollY , {
314
+ inputRange : [ - viewHeight , 0 ] ,
315
+ outputRange : [ 5 * 1.5 , 1 ] ,
297
316
extrapolate : 'clamp'
298
317
} )
299
- : 1
300
- }
301
- ] }
302
- >
303
- < View style = { { height : parallaxHeaderHeight } } >
304
- { renderForeground ( ) }
305
- </ View >
306
- </ Animated . View >
307
- </ View >
318
+ }
319
+ ]
320
+ }
321
+ ] }
322
+ >
323
+ < View >
324
+ { renderForeground ( ) }
325
+ </ View >
326
+ </ Animated . View >
327
+
308
328
)
309
329
}
310
330
@@ -363,12 +383,12 @@ class ParallaxScrollView extends Component {
363
383
}
364
384
365
385
_maybeRenderStickyHeader ( {
366
- parallaxHeaderHeight,
367
- stickyHeaderHeight,
368
- backgroundColor,
369
- renderFixedHeader,
370
- renderStickyHeader
371
- } ) {
386
+ parallaxHeaderHeight,
387
+ stickyHeaderHeight,
388
+ backgroundColor,
389
+ renderFixedHeader,
390
+ renderStickyHeader
391
+ } ) {
372
392
const { viewWidth } = this . state
373
393
const { scrollY } = this
374
394
if ( renderStickyHeader || renderFixedHeader ) {
0 commit comments