Created
June 20, 2019 12:57
-
-
Save tomhicks/d52058bc8f7c228e65aed768bdc7871e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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