Skip to content

Instantly share code, notes, and snippets.

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
@tomhicks
tomhicks / spoingyHeaders.ts
Created June 20, 2019 12:48
Bouncy header helper functions
import {Animated} from "react-native"
export function getSpoingyTransform(
scrollY: Animated.Value,
headerHeight: number,
) {
return [
{
translateY: scrollY.interpolate({
inputRange: [-headerHeight, 0, 1],