Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,22 @@ class ParallaxScrollView extends Component {
}) {
const { viewWidth } = this.state
const { scrollY } = this

const translateY = interpolate(scrollY, {
inputRange: [0, stickyHeaderHeight],
outputRange: [-stickyHeaderHeight, 0],
extrapolate: 'clamp'
})

if (renderStickyHeader || renderFixedHeader) {
const p = pivotPoint(parallaxHeaderHeight, stickyHeaderHeight)
return (
<View
<Animated.View
style={[
styles.stickyHeader,
{
width: viewWidth,
transform: [{ translateY }],
...(stickyHeaderHeight ? { height: stickyHeaderHeight } : null)
}
]}
Expand All @@ -388,8 +396,9 @@ class ParallaxScrollView extends Component {
style={{
backgroundColor: backgroundColor,
height: stickyHeaderHeight,
transform: [{ translateY }],
opacity: interpolate(scrollY, {
inputRange: [0, p],
inputRange: [stickyHeaderHeight, p],
outputRange: [0, 1],
extrapolate: 'clamp'
})
Expand All @@ -413,7 +422,7 @@ class ParallaxScrollView extends Component {
</Animated.View>
: null}
{renderFixedHeader && renderFixedHeader()}
</View>
</Animated.View>
)
} else {
return null
Expand Down