diff --git a/native/flow-typed/npm/react-native-reanimated_v2.x.x.js b/native/flow-typed/npm/react-native-reanimated_v2.x.x.js --- a/native/flow-typed/npm/react-native-reanimated_v2.x.x.js +++ b/native/flow-typed/npm/react-native-reanimated_v2.x.x.js @@ -14,6 +14,26 @@ */ declare module 'react-native-reanimated' { + // This was taken from the flow typed library definitions of bottom-tabs_v6 + declare type StyleObj = + | null + | void + | number + | false + | '' + | $ReadOnlyArray + | { [name: string]: any, ... }; + + declare type ViewStyleProp = StyleObj; + declare type TextStyleProp = StyleObj; + + declare type StyleProps = {| + ...ViewStyleProp, + ...TextStyleProp, + +originX?: number, + +originY?: number, + +[key: string]: any, + |}; declare class Node { } @@ -123,6 +143,7 @@ ... }; declare export var EasingNode: EasingModule; + declare type EasingFn = (t: number) => number; declare export type TimingState = { +finished: Value, @@ -213,6 +234,165 @@ ): Node, |}; + declare type LayoutAnimation = { + +initialValues: StyleProps, + +animations: StyleProps, + +callback?: (finished: boolean) => void, + }; + + declare type AnimationFunction = (a?: any, b?: any, c?: any) => any; + + declare type EntryAnimationsValues = {| + +targetOriginX: number, + +targetOriginY: number, + +targetWidth: number, + +targetHeight: number, + +targetGlobalOriginX: number, + +targetGlobalOriginY: number, + |}; + + declare type ExitAnimationsValues = {| + +currentOriginX: number, + +currentOriginY: number, + +currentWidth: number, + +currentHeight: number, + +currentGlobalOriginX: number, + +currentGlobalOriginY: number, + |}; + + declare export type EntryExitAnimationFunction = ( + targetValues: EntryAnimationsValues | ExitAnimationsValues, + ) => LayoutAnimation; + + declare type AnimationConfigFunction = ( + targetValues: T, + ) => LayoutAnimation; + + declare type LayoutAnimationsValues = {| + +currentOriginX: number, + +currentOriginY: number, + +currentWidth: number, + +currentHeight: number, + +currentGlobalOriginX: number, + +currentGlobalOriginY: number, + +targetOriginX: number, + +targetOriginY: number, + +targetWidth: number, + +targetHeight: number, + +targetGlobalOriginX: number, + +argetGlobalOriginY: number, + +windowWidth: number, + +windowHeight: number, + |}; + + declare type LayoutAnimationFunction = ( + targetValues: LayoutAnimationsValues, + ) => LayoutAnimation; + + declare type BaseLayoutAnimationConfig = {| + +duration?: number, + +easing?: EasingFn, + +type?: AnimationFunction, + +damping?: number, + +mass?: number, + +stiffness?: number, + +overshootClamping?: number, + +restDisplacementThreshold?: number, + +restSpeedThreshold?: number, + |}; + + declare type BaseBuilderAnimationConfig = {| + ...BaseLayoutAnimationConfig, + rotate?: number | string, + |}; + + declare type LayoutAnimationAndConfig = [ + AnimationFunction, + BaseBuilderAnimationConfig, + ]; + + declare export class BaseAnimationBuilder { + static duration(durationMs: number): BaseAnimationBuilder; + duration(durationMs: number): BaseAnimationBuilder; + + static delay(delayMs: number): BaseAnimationBuilder; + delay(delayMs: number): BaseAnimationBuilder; + + static withCallback( + callback: (finished: boolean) => void, + ): BaseAnimationBuilder; + withCallback(callback: (finished: boolean) => void): BaseAnimationBuilder; + + static getDuration(): number; + getDuration(): number; + + static randomDelay(): BaseAnimationBuilder; + randomDelay(): BaseAnimationBuilder; + + getDelay(): number; + getDelayFunction(): AnimationFunction; + + static build(): EntryExitAnimationFunction | LayoutAnimationFunction; + } + + declare export type ReanimatedAnimationBuilder = + | Class + | BaseAnimationBuilder; + + declare export class ComplexAnimationBuilder extends BaseAnimationBuilder { + static easing(easingFunction: EasingFn): ComplexAnimationBuilder; + easing(easingFunction: EasingFn): ComplexAnimationBuilder; + + static rotate(degree: string): ComplexAnimationBuilder; + rotate(degree: string): ComplexAnimationBuilder; + + static springify(): ComplexAnimationBuilder; + springify(): ComplexAnimationBuilder; + + static damping(damping: number): ComplexAnimationBuilder; + damping(damping: number): ComplexAnimationBuilder; + + static mass(mass: number): ComplexAnimationBuilder; + mass(mass: number): ComplexAnimationBuilder; + + static stiffness(stiffness: number): ComplexAnimationBuilder; + stiffness(stiffness: number): ComplexAnimationBuilder; + + static overshootClamping( + overshootClamping: number, + ): ComplexAnimationBuilder; + overshootClamping(overshootClamping: number): ComplexAnimationBuilder; + + static restDisplacementThreshold( + restDisplacementThreshold: number, + ): ComplexAnimationBuilder; + restDisplacementThreshold( + restDisplacementThreshold: number, + ): ComplexAnimationBuilder; + + static restSpeedThreshold( + restSpeedThreshold: number, + ): ComplexAnimationBuilder; + restSpeedThreshold(restSpeedThreshold: number): ComplexAnimationBuilder; + + static withInitialValues(values: StyleProps): BaseAnimationBuilder; + withInitialValues(values: StyleProps): BaseAnimationBuilder; + + getAnimationAndConfig(): LayoutAnimationAndConfig; + } + + declare export class SlideInDown extends ComplexAnimationBuilder { + static createInstance(): SlideInDown; + + build(): AnimationConfigFunction; + } + + declare export class SlideOutDown extends ComplexAnimationBuilder { + static createInstance(): SlideOutDown; + + build(): AnimationConfigFunction; + } + declare type $SyntheticEvent = { +nativeEvent: $ReadOnly<$Exact>, ...