Skip to content

Instantly share code, notes, and snippets.

@anthonyk1225
Created April 9, 2020 15:21
Show Gist options
  • Save anthonyk1225/1e9f4949050cdd2fdd7762189da1d63e to your computer and use it in GitHub Desktop.
Save anthonyk1225/1e9f4949050cdd2fdd7762189da1d63e to your computer and use it in GitHub Desktop.
example of ParallaxScrollView
stickyHeader = () => (
<View><Text>My Sticky Header</Text></View>
)
<ParallaxScrollView
parallaxHeaderHeight={700}
renderStickyHeader={this.stickyHeader}
stickyHeaderHeight={50}
renderForeground={() => (
<Fragment>
{/* Everything that goes before sticky header appears */}
<View style={{ width: '100%', height: 100, backgroundColor: 'red' }} />
</Fragment>
)}
>
<View style={{ width: '100%', height: 100, backgroundColor: 'blue' }} /> // Everything that goes underneath the sticky header
</ParallaxScrollView>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment