@@ -61,8 +61,9 @@ class ScrollViewStickyHeader extends React.Component {
61
61
62
62
render ( ) {
63
63
const { measured, layoutHeight, layoutY, nextHeaderLayoutY} = this . state ;
64
+ const inputRange : Array < number > = [-1, 0];
65
+ const outputRange: Array< number > = [0, 0];
64
66
65
- let translateY ;
66
67
if (measured) {
67
68
// The interpolation looks like:
68
69
// - Negative scroll: no translation
@@ -74,8 +75,8 @@ class ScrollViewStickyHeader extends React.Component {
74
75
// header to continue scrolling up and make room for the next sticky header.
75
76
// In the case that there is no next header just translate equally to
76
77
// scroll indefinetly.
77
- const inputRange = [ - 1 , 0 , layoutY ] ;
78
- const outputRange : Array < number > = [0, 0, 0] ;
78
+ inputRange . push ( layoutY ) ;
79
+ outputRange . push ( 0 ) ;
79
80
// Sometimes headers jump around so we make sure we don't violate the monotonic inputRange
80
81
// condition.
81
82
const collisionPoint = ( nextHeaderLayoutY || 0 ) - layoutHeight ;
@@ -86,14 +87,12 @@ class ScrollViewStickyHeader extends React.Component {
86
87
inputRange . push ( layoutY + 1 ) ;
87
88
outputRange . push ( 1 ) ;
88
89
}
89
- translateY = this . props . scrollAnimatedValue . interpolate ( {
90
- inputRange,
91
- outputRange,
92
- } ) ;
93
- } else {
94
- translateY = 0 ;
95
90
}
96
91
92
+ const translateY = this . props . scrollAnimatedValue . interpolate ( {
93
+ inputRange ,
94
+ outputRange ,
95
+ } );
97
96
const child = React.Children.only(this.props.children);
98
97
99
98
return (
0 commit comments