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 index 0f6b94cea..e5299352e 100644 --- a/native/flow-typed/npm/react-native-reanimated_v2.x.x.js +++ b/native/flow-typed/npm/react-native-reanimated_v2.x.x.js @@ -1,416 +1,596 @@ // flow-typed signature: 3742390ed7eeeb6c96844c62149ea639 // flow-typed version: <>/react-native-reanimated_v2.2.0/flow_v0.137.0 /** * This is an autogenerated libdef stub for: * * 'react-native-reanimated' * * Fill this stub out by replacing all the `any` types. * * Once filled out, we encourage you to share your work with the * community by sending a pull request to: * https://github.com/flowtype/flow-typed */ 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 { } declare class Value extends Node { constructor(val: number): this; setValue(num: number): void; } declare class Clock extends Node { } declare class View extends React$Component<{ ... }> { } declare class Text extends React$Component<{ ... }> { } declare class Image extends React$Component<{ ... }> { } declare class Code extends React$Component<{ +exec: Node, ... }> { } declare type NodeOrNum = Node | number; declare export type NodeParam = NodeOrNum | $ReadOnlyArray; declare type NodeOrArrayOfNodes = Node | $ReadOnlyArray; declare export type Block = ( nodes: $ReadOnlyArray, ) => Node; declare export type Set = (node: Value, val: NodeParam) => Node; declare type ToNumber = (val: mixed) => number; declare export type Call = >( nodes: N, callback: (vals: $TupleMap) => mixed, ) => Node; declare export type Cond = ( cond: NodeParam, branch1: ?NodeParam, branch2?: ?NodeParam, ) => Node; declare export type Not = Node => Node; declare export type And = (...$ReadOnlyArray) => Node; declare export type Or = (...$ReadOnlyArray) => Node; declare export type Eq = (NodeParam, NodeParam) => Node; declare export type Neq = (NodeParam, NodeParam) => Node; declare export type LessThan = (NodeParam, NodeParam) => Node; declare export type GreaterThan = (NodeParam, NodeParam) => Node; declare export type LessOrEq = (NodeParam, NodeParam) => Node; declare export type GreaterOrEq = (NodeParam, NodeParam) => Node; declare export type Add = (...$ReadOnlyArray) => Node; declare export type Sub = (...$ReadOnlyArray) => Node; declare export type Multiply = (...$ReadOnlyArray) => Node; declare export type Divide = (...$ReadOnlyArray) => Node; declare export type Pow = (...$ReadOnlyArray) => Node; declare export type Max = (NodeParam, NodeParam) => Node; declare export type Min = (NodeParam, NodeParam) => Node; declare export type Abs = (NodeParam) => Node; declare export type Ceil = (NodeParam) => Node; declare export type Floor = (NodeParam) => Node; declare export type Round = (NodeParam) => Node; declare export type StartClock = Clock => Node; declare export type StopClock = Clock => Node; declare export type ClockRunning = Clock => Node; declare export type Debug = (string, NodeParam) => Node; declare type ExtrapolateType = { ... }; declare type ExtrapolateModule = { +CLAMP: ExtrapolateType, ... }; declare export type InterpolationConfig = { +inputRange: $ReadOnlyArray, +outputRange: $ReadOnlyArray, +extrapolate?: ?ExtrapolateType, ... }; declare export type InterpolateNode = ( node: NodeParam, interpolationConfig: InterpolationConfig, ) => Node; declare export type InterpolateColorsConfig = { +inputRange: $ReadOnlyArray, +outputColorRange: $ReadOnlyArray, }; declare export type InterpolateColors = ( animationValue: NodeParam, interpolationConfig: InterpolateColorsConfig ) => Node; declare export type Interpolate = ( input: number, inputRange: $ReadOnlyArray, outputRange: $ReadOnlyArray, extrapolate?: ?ExtrapolateType, ) => number; declare type EasingType = { ... }; declare type EasingModule = { +ease: EasingType, +quad: EasingType, +in: EasingType => EasingType, +out: EasingType => EasingType, +inOut: EasingType => EasingType, ... }; declare export var EasingNode: EasingModule; + declare type EasingFn = (t: number) => number; declare export type TimingState = { +finished: Value, +position: Value, +frameTime: Value, +time: Value, ... }; declare export type TimingConfig = { +duration: number, +toValue: NodeOrNum, +easing?: ?EasingType, ... }; declare type Animator = { +start: () => void, ... }; declare type Timing = {| ( value: Value, config: TimingConfig, ): Animator, ( clock: Clock, state: TimingState, config: TimingConfig, ): Node, |}; declare export type SpringConfig = { +overshootClamping: boolean, +damping: number, +mass: number, +toValue: NodeOrNum, ... }; declare type SpringUtilsModule = { +makeDefaultConfig: () => SpringConfig, +makeConfigFromBouncinessAndSpeed: ({ ...SpringConfig, +bounciness: ?number, +speed: ?number, ... }) => SpringConfig, ... }; declare export type SpringState = { +finished: Value, +position: Value, +velocity: Value, +time: Value, ... }; declare type Spring = {| ( value: Value, config: SpringConfig, ): Animator, ( clock: Clock, state: SpringState, config: SpringConfig, ): Node, |}; declare export type DecayConfig = { +deceleration: number, ... }; declare export type DecayState = { +finished: Value, +position: Value, +velocity: Value, +time: Value, ... }; declare type Decay = {| ( value: Value, config: DecayConfig, ): Animator, ( clock: Clock, state: DecayState, config: DecayConfig, ): 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>, ... }; declare type GestureStateUndetermined = 0; declare type GestureStateFailed = 1; declare type GestureStateBegan = 2; declare type GestureStateCancelled = 3; declare type GestureStateActive = 4; declare type GestureStateEnd = 5; declare type GestureState = | GestureStateUndetermined | GestureStateFailed | GestureStateBegan | GestureStateCancelled | GestureStateActive | GestureStateEnd; declare type $Event = $SyntheticEvent<{ handlerTag: number, numberOfPointers: number, state: GestureState, oldState: GestureState, ...$Exact, ... }>; declare type ToValue = (val: mixed) => Value; declare type Event = >(defs: $ReadOnlyArray<{ +nativeEvent: $Shape<$ObjMap>, ... }>) => E; declare type UseValue = (initialVal: number) => Value; declare type AnimatedGestureHandlerEventCallback> = ( event: $Shape, context: {| [name: string]: mixed |}, ) => mixed; declare type UseAnimatedGestureHandler = >( callbacks: $Shape<{| +onStart: AnimatedGestureHandlerEventCallback, +onActive: AnimatedGestureHandlerEventCallback, +onEnd: AnimatedGestureHandlerEventCallback, +onFail: AnimatedGestureHandlerEventCallback, +onCancel: AnimatedGestureHandlerEventCallback, +onFinish: AnimatedGestureHandlerEventCallback, |}>, dependencies?: $ReadOnlyArray, ) => E; declare export type SharedValue = { value: T, ... }; declare type UseSharedValue = (val: T) => SharedValue; declare type UseDerivedValue = ( updater: () => T, dependencies?: $ReadOnlyArray, ) => SharedValue; declare type UseAnimatedStyle = ( styleSelector: () => T, dependencies?: $ReadOnlyArray, ) => T; declare type WithSpringConfig = $Shape<{| +stiffness: number, +damping: number, +mass: number, +overshootClamping: boolean, +restDisplacementThreshold: number, +restSpeedThreshold: number, +velocity: number, |}>; // Doesn't actually return a number, but sharedValue.value has a differently // typed getter vs. setter, and Flow doesn't support that declare type WithSpring = ( toValue: number | string, springConfig?: WithSpringConfig, ) => number; declare type RunOnJS = (func: F) => F; declare type CancelAnimation = (animation: number) => void; declare export var Node: typeof Node; declare export var Value: typeof Value; declare export var Clock: typeof Clock; declare export var View: typeof View; declare export var Text: typeof Text; declare export var Image: typeof Image; declare export var Code: typeof Code; declare export var block: Block; declare export var set: Set; declare export var call: Call; declare export var cond: Cond; declare export var not: Not; declare export var and: And; declare export var or: Or; declare export var eq: Eq; declare export var neq: Neq; declare export var lessThan: LessThan; declare export var greaterThan: GreaterThan; declare export var lessOrEq: LessOrEq; declare export var greaterOrEq: GreaterOrEq; declare export var add: Add; declare export var sub: Sub; declare export var multiply: Multiply; declare export var divide: Divide; declare export var pow: Pow; declare export var max: Max; declare export var min: Min; declare export var abs: Abs; declare export var ceil: Ceil; declare export var floor: Floor; declare export var round: Round; declare export var startClock: StartClock; declare export var stopClock: StopClock; declare export var clockRunning: ClockRunning; declare export var debug: Debug; declare export var interpolateNode: InterpolateNode; declare export var interpolateColors: InterpolateColors; declare export var interpolate: Interpolate; declare export var Extrapolate: ExtrapolateModule; declare export var timing: Timing; declare export var SpringUtils: SpringUtilsModule; declare export var spring: Spring; declare export var decay: Decay; declare export var event: Event; declare export var useValue: UseValue; declare export var useAnimatedGestureHandler: UseAnimatedGestureHandler; declare export var useSharedValue: UseSharedValue; declare export var useDerivedValue: UseDerivedValue; declare export var useAnimatedStyle: UseAnimatedStyle; declare export var withSpring: WithSpring; declare export var runOnJS: RunOnJS; declare export var cancelAnimation: CancelAnimation; declare export default { +Node: typeof Node, +Value: typeof Value, +Clock: typeof Clock, +View: typeof View, +Text: typeof Text, +Image: typeof Image, +Code: typeof Code, +block: Block, +set: Set, +call: Call, +cond: Cond, +not: Not, +and: And, +or: Or, +eq: Eq, +neq: Neq, +lessThan: LessThan, +greaterThan: GreaterThan, +lessOrEq: LessOrEq, +greaterOrEq: GreaterOrEq, +add: Add, +sub: Sub, +multiply: Multiply, +divide: Divide, +pow: Pow, +max: Max, +min: Min, +abs: Abs, +ceil: Ceil, +floor: Floor, +round: Round, +startClock: StartClock, +stopClock: StopClock, +clockRunning: ClockRunning, +debug: Debug, +interpolateNode: InterpolateNode, +interpolateColors: InterpolateColors, +interpolate: Interpolate, +Extrapolate: ExtrapolateModule, +timing: Timing, +spring: Spring, +decay: Decay, +SpringUtils: SpringUtilsModule, +event: Event, +useValue: UseValue, +useAnimatedGestureHandler: UseAnimatedGestureHandler, +useSharedValue: UseSharedValue, +useDerivedValue: UseDerivedValue, +useAnimatedStyle: UseAnimatedStyle, +withSpring: WithSpring, +runOnJS: RunOnJS, +cancelAnimation: CancelAnimation, ... }; }