UNPKG

react-animated-list

Version:

Simple way of animating when components are added or removed from an array

20 lines (19 loc) 1.02 kB
/// <reference types="react" /> import { GrowProps } from "@material-ui/core/Grow"; import { FadeProps } from "@material-ui/core/Fade"; import { SlideProps } from "@material-ui/core/Slide"; import { ZoomProps } from "@material-ui/core/Zoom"; import { CollapseProps } from "@material-ui/core/Collapse"; declare type AnimType = "grow" | "fade" | "slide" | "zoom" | "collapse"; declare type AnimProps = GrowProps | FadeProps | SlideProps | ZoomProps | CollapseProps; declare type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & { [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>; }[Keys]; interface ListProps { children: RequireAtLeastOne<any, "key">[] | RequireAtLeastOne<any, "key">; animation?: AnimType; animationProps?: AnimProps; initialAnimationDuration?: number; } export declare const AnimatedList: ({ children, animation, animationProps, initialAnimationDuration, }: ListProps) => JSX.Element; export {};