Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TSDoc to public API #5377

Merged
merged 57 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
954affd
Update animation object description
kacperkapusciak Nov 14, 2023
1b2c60d
Update withRepeat docs
kacperkapusciak Nov 14, 2023
e2d9968
TSDoc animation functions
kacperkapusciak Nov 14, 2023
ca47564
Remove redundant TSDoc
kacperkapusciak Nov 14, 2023
df3f712
Deprecate useWorkletCallback
kacperkapusciak Nov 14, 2023
4baed9f
TSDoc core functions
kacperkapusciak Nov 14, 2023
bdde95f
Add animation object link to tsdoc
kacperkapusciak Nov 14, 2023
52d7b6e
Fix passive voice misuse
kacperkapusciak Nov 14, 2023
2e8fafc
TSDoc scroll functions
kacperkapusciak Nov 14, 2023
532bb02
TSDoc useAnimatedKeyboard
kacperkapusciak Nov 14, 2023
b3479f0
Add `eslint-plugin-tsdoc`
kacperkapusciak Nov 15, 2023
f7cc652
Conform to `eslint-plugin-tsdoc`
kacperkapusciak Nov 15, 2023
34f4464
TSDoc device hooks
kacperkapusciak Nov 16, 2023
ea348e6
TSDoc layout animatons
kacperkapusciak Nov 16, 2023
030c67d
Add info about modifiers
kacperkapusciak Nov 16, 2023
5b5e838
Fix some typos in docs
kacperkapusciak Nov 16, 2023
1a4ba63
TSDoc layout transitions
kacperkapusciak Nov 16, 2023
fd61cf5
TSDoc shared element transitions
kacperkapusciak Nov 17, 2023
dec9ddf
Add layout animation modifier to glossary
kacperkapusciak Nov 17, 2023
76ed89b
TSDoc layout animation modifiers
kacperkapusciak Nov 17, 2023
8e6e4e1
Update deprecated comments and some links
kacperkapusciak Nov 17, 2023
300c7f3
TSDoc spring
kacperkapusciak Nov 17, 2023
242c854
TSDoc timing
kacperkapusciak Nov 17, 2023
b0c4279
Update timing docs
kacperkapusciak Nov 17, 2023
a5f6477
Revert type change
kacperkapusciak Nov 21, 2023
6f7d24d
TSDoc decay
kacperkapusciak Nov 21, 2023
6e7b51e
Fix reduceMotion default value and links
kacperkapusciak Nov 22, 2023
0b52c00
TSDoc animatedProps
kacperkapusciak Nov 22, 2023
b1cfb70
Properly TSDoc useAnimatedStyle and useDerivedValue
kacperkapusciak Nov 22, 2023
78c2a78
TSDoc threading
kacperkapusciak Nov 22, 2023
ba9c266
Merge current main
kacperkapusciak Nov 24, 2023
c7030f2
TSDoc interpolation
kacperkapusciak Nov 24, 2023
43823f9
TSDoc interpolateColor
kacperkapusciak Nov 24, 2023
e2d0cdb
Unify interpolate params with interpolateColors
kacperkapusciak Nov 24, 2023
cd5f81f
TSDoc getRelativeCoords
kacperkapusciak Nov 24, 2023
9fcf7c0
TSDoc measure
kacperkapusciak Nov 24, 2023
d7d030b
TSDoc useAnimatedReaction
kacperkapusciak Nov 24, 2023
988cfa1
TSDoc useFrameCallback
kacperkapusciak Nov 24, 2023
8e7a4b4
TSDoc setNativeProps
kacperkapusciak Nov 24, 2023
5a56397
TSDoc dispatchCommand
kacperkapusciak Nov 24, 2023
8e685ef
Fix TSDoc on runOnUI
kacperkapusciak Nov 24, 2023
b98c97c
TSDoc useEvent
kacperkapusciak Nov 24, 2023
c51f2d3
TSDoc useHandler
kacperkapusciak Nov 24, 2023
432b62f
Fix casing and punctuation
kacperkapusciak Nov 24, 2023
6043f7b
Fix casing and punctuation
kacperkapusciak Nov 24, 2023
6c3df70
Moar casing and punctiation fixes
kacperkapusciak Nov 24, 2023
a23c107
Remove unnecessary line
kacperkapusciak Nov 24, 2023
0a815da
Fix some links
kacperkapusciak Nov 24, 2023
0048612
Add missing docs link in useFrameCallback
kacperkapusciak Nov 24, 2023
fffc5de
Add link to shared value glossary
kacperkapusciak Nov 24, 2023
9c5327a
Update shared value TSDoc and documentation
kacperkapusciak Nov 24, 2023
cfd3141
Fix links 🙈
kacperkapusciak Nov 24, 2023
0f365d7
TSDoc flatlist props
kacperkapusciak Nov 24, 2023
7a054f4
TSDoc layout props
kacperkapusciak Nov 24, 2023
deaba40
Merge branch 'main' into @kacperkapusciak/add-ts-doc
kacperkapusciak Nov 24, 2023
5eb5d59
Merge branch 'main' into @kacperkapusciak/add-ts-doc
kacperkapusciak Nov 29, 2023
2abba03
Apply feedback from CR
kacperkapusciak Nov 29, 2023
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
10 changes: 9 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ module.exports = {
'plugin:import/typescript',
'plugin:react-hooks/recommended',
],
plugins: ['react', 'react-native', 'import', 'jest', '@typescript-eslint'],
plugins: [
'react',
'react-native',
'import',
'jest',
'@typescript-eslint',
'eslint-plugin-tsdoc',
],
env: {
'react-native/react-native': true,
'jest/globals': true,
Expand Down Expand Up @@ -52,5 +59,6 @@ module.exports = {
'error',
{ fixMixedExportsWithInlineTypeSpecifier: false },
],
'tsdoc/syntax': 'error',
},
};
4 changes: 2 additions & 2 deletions docs/docs/advanced/setNativeProps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sidebar_position: 7

`setNativeProps` is an escape hatch for specific edge-cases.

You should always reach for [`useAnimatedStyle`](docs/core/useAnimatedStyle) and [`useAnimatedProps`](docs/core/useAnimatedProps) first when animating styles or properties.
You should always reach for [`useAnimatedStyle`](/docs/core/useAnimatedStyle) and [`useAnimatedProps`](/docs/core/useAnimatedProps) first when animating styles or properties.

:::

Expand Down Expand Up @@ -48,7 +48,7 @@ function setNativeProps<T extends Component>(

#### `animatedRef`

An [animated ref](/docs/core/useAnimatedRef#returns) connected to the component you'd want to get the measurements from. The animated ref has to be passed either to an [Animated component](/docs/fundamentals/glossary#animated-component) or a React Native built-in component.
An [animated ref](/docs/core/useAnimatedRef#returns) connected to the component you'd want to update. The animated ref has to be passed either to an [Animated component](/docs/fundamentals/glossary#animated-component) or a React Native built-in component.

#### `updates`

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/animations/withDecay.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 3

# withDecay

`withDecay` lets you create animations that mimic objects in motion. The animation will start with the provided velocity and slow down over time according to the given deceleration rate until it stops.
`withDecay` lets you create animations that mimic objects in motion with friction. The animation will start with the provided velocity and slow down over time according to the given deceleration rate until it stops.

import DecayBasic from '@site/src/examples/DecayBasic';
import DecayBasicSrc from '!!raw-loader!@site/src/examples/DecayBasic';
Expand Down Expand Up @@ -80,7 +80,7 @@ A function called on animation complete. In case the animation is cancelled, the

### Returns

`withDecay` returns an [animation object](/docs/fundamentals/glossary#animation-object). It can be either assigned directly to a [shared value](/docs/fundamentals/glossary#shared-value) or can be used as a value for a style object returned from [useAnimatedStyle](/docs/core/useAnimatedStyle).
`withDecay` returns an [animation object](/docs/fundamentals/glossary#animation-object) which holds the current state of the animation. It can be either assigned directly to a [shared value](/docs/fundamentals/glossary#shared-value) or can be used as a value for a style object returned from [useAnimatedStyle](/docs/core/useAnimatedStyle).

## Example

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/animations/withDelay.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ A parameter that determines how the animation responds to the device's reduced m

### Returns

`withDelay` returns an [animation object](/docs/fundamentals/glossary#animation-object). It can be either assigned directly to a [shared value](/docs/fundamentals/glossary#shared-value) or can be used as a value for a style object returned from [useAnimatedStyle](docs/core/useAnimatedStyle).
`withDelay` returns an [animation object](/docs/fundamentals/glossary#animation-object) which holds the current state of the animation. It can be either assigned directly to a [shared value](/docs/fundamentals/glossary#shared-value) or can be used as a value for a style object returned from [useAnimatedStyle](docs/core/useAnimatedStyle).

## Example

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/animations/withRepeat.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ enum ReduceMotion {

#### `animation`

The animation you want to repeat.
An [animation object](/docs/fundamentals/glossary#animation-object) you want to repeat.

#### `numberOfReps` <Optional />

Expand All @@ -73,7 +73,7 @@ A parameter that determines how the animation responds to the device's reduced m

### Returns

`withRepeat` returns an [animation object](/docs/fundamentals/glossary#animation-object). It can be either assigned directly to a [shared value](/docs/fundamentals/glossary#shared-value) or can be used as a value for a style object returned from [useAnimatedStyle](docs/core/useAnimatedStyle).
`withRepeat` returns an [animation object](/docs/fundamentals/glossary#animation-object) which holds the current state of the animation. It can be either assigned directly to a [shared value](/docs/fundamentals/glossary#shared-value) or can be used as a value for a style object returned from [useAnimatedStyle](docs/core/useAnimatedStyle).

## Example

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/animations/withSequence.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Any number of [animation objects](docs/fundamentals/glossary#animation-object) t

### Returns

`withSequence` returns an [animation object](/docs/fundamentals/glossary#animation-object). It can be either assigned directly to a [shared value](/docs/fundamentals/glossary#shared-value) or can be used as a value for a style object returned from [useAnimatedStyle](docs/core/useAnimatedStyle).
`withSequence` returns an [animation object](/docs/fundamentals/glossary#animation-object) which holds the current state of the animation. It can be either assigned directly to a [shared value](/docs/fundamentals/glossary#shared-value) or can be used as a value for a style object returned from [useAnimatedStyle](docs/core/useAnimatedStyle).

## Example

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/animations/withSpring.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Available properties:
| overshootClamping | `boolean` | false | Whether a spring can bounce over the `toValue`. |
| restDisplacementThreshold | `number` | 0.01 | The displacement below which the spring will snap to `toValue` without further oscillations. |
| restSpeedThreshold | `number` | 2 | The speed in pixels per second from which the spring will snap to `toValue` without further oscillations. |
| reduceMotion <Optional /> | `ReduceMotion` | `ReduceMotion.System` | A parameter that determines how the animation responds to the device's reduced motion accessibility setting. |
| reduceMotion | `ReduceMotion` | `ReduceMotion.System` | A parameter that determines how the animation responds to the device's reduced motion accessibility setting. |

:::info
The `mass` and `damping` (physics-based) properties can't be used at the same time as `duration` and `dampingRatio` (duration-based).
Expand All @@ -95,7 +95,7 @@ A function called upon animation completion. If the animation is cancelled, the

### Returns

`withSpring` returns an [animation object](/docs/fundamentals/glossary#animation-object). It can be either assigned directly to a [shared value](/docs/fundamentals/glossary#shared-value) or can be used as a value for a style object returned from [useAnimatedStyle](docs/core/useAnimatedStyle).
`withSpring` returns an [animation object](/docs/fundamentals/glossary#animation-object) which holds the current state of the animation. It can be either assigned directly to a [shared value](/docs/fundamentals/glossary#shared-value) or can be used as a value for a style object returned from [useAnimatedStyle](docs/core/useAnimatedStyle).

## Example

Expand Down
12 changes: 6 additions & 6 deletions docs/docs/animations/withTiming.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ import { useTimingPlayground } from '@site/src/components/InteractivePlayground'

Available properties:

| Name | Type | Default | Description |
| ------------------------- | -------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------ |
| duration <Optional /> | `number` | 300 | Length of the animation (in milliseconds). |
| easing <Optional /> | `Easing` | `Easing.inOut(Easing.quad)` | An easing function which defines the animation curve. |
| reduceMotion <Optional /> | `ReduceMotion` | `ReduceMotion.System` | A parameter that determines how the animation responds to the device's reduced motion accessibility setting. |
| Name | Type | Default | Description |
| ------------ | -------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------ |
| duration | `number` | 300 | Length of the animation (in milliseconds). |
| easing | `Easing` | `Easing.inOut(Easing.quad)` | An easing function which defines the animation curve. |
| reduceMotion | `ReduceMotion` | `ReduceMotion.System` | A parameter that determines how the animation responds to the device's reduced motion accessibility setting. |

##### `Easing`

Expand Down Expand Up @@ -124,7 +124,7 @@ A function called upon animation completion. If the animation is cancelled, the

### Returns

`withTiming` returns an [animation object](/docs/fundamentals/glossary#animation-object). It can be either assigned directly to a [shared value](/docs/fundamentals/glossary#shared-value) or can be used as a value for a style object returned from [useAnimatedStyle](docs/core/useAnimatedStyle).
`withTiming` returns an [animation object](/docs/fundamentals/glossary#animation-object) which holds the current state of the animation. It can be either assigned directly to a [shared value](/docs/fundamentals/glossary#shared-value) or can be used as a value for a style object returned from [useAnimatedStyle](docs/core/useAnimatedStyle).

## Example

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/core/useAnimatedRef.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 4

`useAnimatedRef` lets you get a reference of a view. Used alongside [`measure`](/docs/advanced/measure), [`scrollTo`](/docs/scroll/scrollTo), and [`useScrollViewOffset`](/docs/scroll/useScrollViewOffset) functions.

An object defined using `useAnimatedRef` has to be passed to the `ref` property of a component.
You need to pass the object defined using `useAnimatedRef` to the `ref` property of a component.

## Reference

Expand Down
20 changes: 19 additions & 1 deletion docs/docs/fundamentals/glossary.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const AnimatedCircle = Animated.createAnimatedComponent(Circle);

Shared values are a driving factor of all your animations in Reanimated.

They are defined using `useSharedValue` hook:
They are defined using [`useSharedValue`](/docs/core/useSharedValue) hook:

```javascript
import { useSharedValue } from 'react-native-reanimated';
Expand Down Expand Up @@ -111,6 +111,24 @@ function App() {
}
```

## Layout animation modifier

Layout animation modifiers are methods used to customize layout animations.

```jsx
<Animated.View entering={FadeOutLeft.duration(500).easing(Easing.ease)} />
```

Reanimated comes with plenty of built-in layout animation modifiers. Some of them are:

- `.duration(durationMs: number)` - the length of the animation (in milliseconds).
- `.easing(easingFunction: EasingFunction)` - an easing function which defines the animation curve.
- `.springify()` - enables the spring-based animation configuration.
- `.damping(value: number)` - decides how quickly a spring stops moving.
- `.withCallback(callback: (finished: boolean) => void)` - the callback that will fire after the animation ends.

For a list of all available modifiers for each animation refer to the documentation of individual layout animation.

## Worklet

Worklets are short-running JavaScript functions that can be run on the [UI thread](/docs/fundamentals/glossary#ui-thread). They can also be run on a JavaScript thread just as you would run a function in your code.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/layout-animations/layout-animation-config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import LayoutAnimationConfigSrc from '!!raw-loader!@site/src/examples/LayoutAnim

## Platform compatibility

<div className="compatibility">
<div className="platform-compatibility">

| Android | iOS | Web |
| ------- | --- | --- |
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/layout-animations/layout-transitions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Below we listed all of the currently available predefined layout transitions. Ea

If you cannot find an transition that suits you then you can create a custom one. If you think that the animation should be here, please open an issue or create a pull request.

### Layout
### Linear transition

Linear transition, animates both position and dimension in the same way.

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-standard": "^5.0.0",
"eslint-plugin-tsdoc": "^0.2.17",
"husky": "^7.0.4",
"jest": "^29.0.0",
"lint-staged": "^11.2.0",
Expand Down
7 changes: 7 additions & 0 deletions src/createAnimatedComponent/createAnimatedComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ type Options<P> = {
setNativeProps: (ref: AnimatedComponentRef, props: P) => void;
};

/**
* Lets you create an Animated version of any React Native component.
*
* @param component - The component you want to make animatable.
* @returns A component that Reanimated is capable of animating.
* @see https://docs.swmansion.com/react-native-reanimated/docs/core/createAnimatedComponent
*/
export function createAnimatedComponent<P extends object>(
component: FunctionComponent<P>,
options?: Options<P>
Expand Down
2 changes: 2 additions & 0 deletions src/createAnimatedComponent/setAndForwardRef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import type { MutableRefObject } from 'react';

/* eslint-disable */
/**
* This is a helper function for when a component needs to be able to forward a ref
* to a child component, but still needs to have access to that component as part of
Expand Down Expand Up @@ -35,6 +36,7 @@ import type { MutableRefObject } from 'react';
*
* module.exports = MyViewWithRef;
*/
/* eslint-enable */

type ForwardedRef<T> = () => MutableRefObject<T> | ((ref: T) => void);

Expand Down
6 changes: 3 additions & 3 deletions src/reanimated2/Easing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ import { Bezier } from './Bezier';
export type EasingFunction = (t: number) => number;

/**
* @deprecated Please use `EasingFunction` type instead.
* @deprecated Please use {@link EasingFunction} type instead.
*/
export type EasingFn = EasingFunction;

export type EasingFunctionFactory = { factory: () => EasingFunction };

/**
* @deprecated Please use `EasingFunctionFactory` type instead.
* @deprecated Please use {@link EasingFunctionFactory} type instead.
*/
export type EasingFactoryFn = EasingFunctionFactory;
/**
Expand Down Expand Up @@ -153,7 +153,7 @@ function exp(t: number): number {
* forth.
*
* Default bounciness is 1, which overshoots a little bit once. 0 bounciness
* doesn't overshoot at all, and bounciness of N > 1 will overshoot about N
* doesn't overshoot at all, and bounciness of N \> 1 will overshoot about N
* times.
*
* http://easings.net/#easeInElastic
Expand Down
8 changes: 8 additions & 0 deletions src/reanimated2/animation/decay/decay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ function validateConfig(config: DefaultDecayConfig): void {
}
}

/**
* Lets you create animations that mimic objects in motion with friction.
*
* @param config - The decay animation configuration - {@link DecayConfig}.
* @param callback - A function called upon animation completion - {@link AnimationCallback}.
* @returns An [animation object](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animation-object) which holds the current state of the animation.
* @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withDecay
*/
export const withDecay = function (
userConfig: DecayConfig,
callback?: AnimationCallback
Expand Down
12 changes: 12 additions & 0 deletions src/reanimated2/animation/decay/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ export interface InnerDecayAnimation
springActive?: boolean;
}

/**
* The decay animation configuration.
*
* @param velocity - Initial velocity of the animation. Defaults to 0.
* @param deceleration - The rate at which the velocity decreases over time. Defaults to 0.998.
* @param clamp - Array of two numbers which restricts animation's range. Defaults to [].
* @param velocityFactor - Velocity multiplier. Defaults to 1.
* @param rubberBandEffect - Makes the animation bounce over the limit specified in `clamp`. Defaults to `false`.
* @param rubberBandFactor - Strength of the rubber band effect. Defaults to 0.6.
* @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.
* @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withDecay#config
*/
export type DecayConfig = {
deceleration?: number;
velocityFactor?: number;
Expand Down
9 changes: 9 additions & 0 deletions src/reanimated2/animation/delay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ type withDelayType = <T extends AnimatableValue>(
reduceMotion?: ReduceMotion
) => T;

/**
* An animation modifier that lets you start an animation with a delay.
*
* @param delayMs - Duration (in milliseconds) before the animation starts.
* @param nextAnimation - The animation to delay.
* @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.
* @returns An [animation object](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animation-object) which holds the current state of the animation.
* @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withDelay
*/
export const withDelay = function <T extends AnimationObject>(
delayMs: number,
_nextAnimation: T | (() => T),
Expand Down
11 changes: 11 additions & 0 deletions src/reanimated2/animation/repeat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ type withRepeatType = <T extends AnimatableValue>(
reduceMotion?: ReduceMotion
) => T;

/**
* Lets you repeat an animation given number of times or run it indefinitely.
*
* @param animation - An animation object you want to repeat.
* @param numberOfReps - The number of times the animation is going to be repeated. Defaults to 2.
* @param reverse - Whether the animation should run in reverse every other repetition. Defaults to false.
* @param callback - A function called on animation complete.
* @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.
* @returns An [animation object](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animation-object) which holds the current state of the animation.
* @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withRepeat
*/
export const withRepeat = function <T extends AnimationObject>(
_nextAnimation: T | (() => T),
numberOfReps = 2,
Expand Down
8 changes: 8 additions & 0 deletions src/reanimated2/animation/sequence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ import type {
Timestamp,
} from '../commonTypes';

/**
* Lets you run animations in a sequence.
*
* @param reduceMotion - Determines how the animation responds to the device's reduced motion accessibility setting. Default to `ReduceMotion.System` - {@link ReduceMotion}.
* @param animations - Any number of animation objects to be run in a sequence.
* @returns An [animation object](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animation-object) which holds the current state of the animation/
* @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withSequence
*/
export function withSequence<T extends AnimatableValue>(
_reduceMotion: ReduceMotion,
...animations: T[]
Expand Down
9 changes: 9 additions & 0 deletions src/reanimated2/animation/spring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ type withSpringType = <T extends AnimatableValue>(
callback?: AnimationCallback
) => T;

/**
* Lets you create spring-based animations.
*
* @param toValue - the value at which the animation will come to rest - {@link AnimatableValue}
* @param config - the spring animation configuration - {@link SpringConfig}
* @param callback - a function called on animation complete - {@link AnimationCallback}
* @returns an [animation object](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animation-object) which holds the current state of the animation
* @see https://docs.swmansion.com/react-native-reanimated/docs/animations/withSpring
*/
export const withSpring = ((
toValue: AnimatableValue,
userConfig?: SpringConfig,
Expand Down
Loading