Skip to content

Instantly share code, notes, and snippets.

@tomhicks
Created June 20, 2019 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomhicks/d52058bc8f7c228e65aed768bdc7871e to your computer and use it in GitHub Desktop.
Save tomhicks/d52058bc8f7c228e65aed768bdc7871e to your computer and use it in GitHub Desktop.
import * as React from "react"
import {captureScroll, getSpoingyTransform} from "spoingyHelpers"
import {Animated} from "react-native"
const headerHeight = 300
export default () => {
// use an instance variable if using component classes
const scrollY = React.useRef(new Animated.Value(0)).current
return <Animated.ScrollView {...captureScroll(scrollY)}>
<Animated.Image
source={myImageSource}
style={{
width: theme.dimensions.width,
height: headerHeight,
transform: getSpoingyTransform(scrollY, headerHeight),
}}
/>
<OtherContentHere />
</Animated.ScrollView>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment