Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add the SpringValue interface
  • Loading branch information
jacobrask committed Feb 19, 2019
commit c38f265eb3fff620fea5b353bdff9bb4b62ce2ef
7 changes: 7 additions & 0 deletions src/animated/Animated.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* The public API for Animated classes.
*/
export interface SpringValue<T> {
getValue: () => T
}

export default abstract class Animated {
abstract addChild(child: Animated): void
abstract removeChild(child: Animated): void
Expand Down
11 changes: 4 additions & 7 deletions src/animated/createAnimatedComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ import React, {
useRef,
} from 'react'
import { handleRef, useForceUpdate } from '../shared/helpers'
import { SpringValue } from './Animated'
import AnimatedProps from './AnimatedProps'
import { animatedApi, applyAnimatedValues } from './Globals'

type AnimatedValue<T> = {
getValue: () => T
}

type AnimateProperties<T extends object | undefined> = {
[P in keyof T]: AnimatedValue<T[P]> | T[P]
[P in keyof T]: SpringValue<T[P]> | T[P]
}

type AnimateStyleProp<P extends object> = P extends { style?: object }
Expand All @@ -32,8 +29,8 @@ type AnimateStyleProp<P extends object> = P extends { style?: object }
: P

type ScrollProps = {
scrollLeft?: AnimatedValue<number>
scrollTop?: AnimatedValue<number>
scrollLeft?: SpringValue<number>
scrollTop?: SpringValue<number>
}

type AnimatedComponentProps<C extends ReactType> = JSX.LibraryManagedAttributes<
Expand Down