UNPKG

react-native

Version:

A framework for building native apps using React

44 lines (42 loc) 3.24 kB
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @generated SignedSource<<008486b075d25ce1531e33736e20f9f9>> * * This file was translated from Flow by scripts/js-api/build-types/index.js. * Original file: packages/react-native/Libraries/Animated/createAnimatedComponent.js */ import type AnimatedAddition from "./nodes/AnimatedAddition"; import type AnimatedDiffClamp from "./nodes/AnimatedDiffClamp"; import type AnimatedDivision from "./nodes/AnimatedDivision"; import type AnimatedInterpolation from "./nodes/AnimatedInterpolation"; import type AnimatedModulo from "./nodes/AnimatedModulo"; import type AnimatedMultiplication from "./nodes/AnimatedMultiplication"; import type AnimatedNode from "./nodes/AnimatedNode"; import type { AnimatedPropsAllowlist } from "./nodes/AnimatedProps"; import type AnimatedSubtraction from "./nodes/AnimatedSubtraction"; import type AnimatedValue from "./nodes/AnimatedValue"; import { type ViewProps } from "../Components/View/ViewPropTypes"; import * as React from "react"; type Nullable = void | null; type Primitive = string | number | boolean | symbol | void; type Builtin = (...$$REST$$: ReadonlyArray<never>) => unknown | Date | Error | RegExp; export type WithAnimatedValue<T> = T extends Builtin | Nullable ? T : T extends Primitive ? T | AnimatedNode | AnimatedAddition | AnimatedSubtraction | AnimatedDivision | AnimatedMultiplication | AnimatedModulo | AnimatedDiffClamp | AnimatedValue | AnimatedInterpolation<number | string> | AnimatedInterpolation<number> | AnimatedInterpolation<string> : T extends ReadonlyArray<infer P> ? ReadonlyArray<WithAnimatedValue<P>> : T extends {} ? { readonly [K in keyof T]: WithAnimatedValue<T[K]> } : T; type NonAnimatedProps = "ref" | "innerViewRef" | "scrollViewRef" | "testID" | "disabled" | "accessibilityLabel"; type PassThroughProps = Readonly<{ passthroughAnimatedPropExplicitValues?: ViewProps | null; }>; type LooseOmit<O extends {}, K extends keyof any> = Pick<O, Exclude<keyof O, K>>; export type AnimatedProps<Props extends {}> = LooseOmit<{ [K in keyof Props]: K extends NonAnimatedProps ? Props[K] : WithAnimatedValue<Props[K]> }, "ref"> & PassThroughProps; export type AnimatedBaseProps<Props extends {}> = LooseOmit<{ [K in keyof Props]: K extends NonAnimatedProps ? Props[K] : WithAnimatedValue<Props[K]> }, "ref">; export type AnimatedComponentType<Props extends {}, Instance = unknown> = (props: Omit<AnimatedProps<Props>, keyof { ref?: React.Ref<Instance>; }> & { ref?: React.Ref<Instance>; }) => React.ReactNode; declare function createAnimatedComponent<TInstance extends React.ComponentType<any>>(Component: TInstance): AnimatedComponentType<Readonly<React.JSX.LibraryManagedAttributes<TInstance, React.ComponentProps<TInstance>>>, React.ComponentRef<TInstance>>; export default createAnimatedComponent; export declare function unstable_createAnimatedComponentWithAllowlist<TProps extends {}, TInstance extends React.ComponentType<TProps>>(Component: TInstance, allowlist: null | undefined | AnimatedPropsAllowlist): AnimatedComponentType<TProps, React.ComponentRef<TInstance>>;