Skip to content

Commit 9666a68

Browse files
coadofacebook-github-bot
authored andcommitted
Attach docs in AnimatedExports (#50975)
Summary: Pull Request resolved: #50975 Re-defining types in `AnimatedExports.js.flow` shadows their documentation located in `AnimatedImplementation`. Moving them to the `AnimatedExports` fixes the issue for generated TS types. Changelog: [Internal] Reviewed By: huntie Differential Revision: D73840908 fbshipit-source-id: 2648498a53660b483c70be647716accc11e96d82
1 parent f882206 commit 9666a68

File tree

2 files changed

+126
-121
lines changed

2 files changed

+126
-121
lines changed

packages/react-native/Libraries/Animated/AnimatedExports.js.flow

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,149 @@ export type {default as AnimatedSubtraction} from './nodes/AnimatedSubtraction';
4040
export type {WithAnimatedValue} from './createAnimatedComponent';
4141
export type {AnimatedComponentType as AnimatedComponent} from './createAnimatedComponent';
4242

43+
/**
44+
* Creates a new Animated value composed from two Animated values added
45+
* together.
46+
*
47+
* See https://reactnative.dev/docs/animated#add
48+
*/
4349
export const add = AnimatedImplementation.add;
50+
51+
/**
52+
* Imperative API to attach an animated value to an event on a view. Prefer
53+
* using `Animated.event` with `useNativeDrive: true` if possible.
54+
*
55+
* See https://reactnative.dev/docs/animated#attachnativeevent
56+
*/
4457
export const attachNativeEvent = AnimatedImplementation.attachNativeEvent;
58+
59+
/**
60+
* Make any React component Animatable. Used to create `Animated.View`, etc.
61+
*
62+
* See https://reactnative.dev/docs/animated#createanimatedcomponent
63+
*/
4564
export const createAnimatedComponent =
4665
AnimatedImplementation.createAnimatedComponent;
66+
67+
/**
68+
* Animates a value from an initial velocity to zero based on a decay
69+
* coefficient.
70+
*
71+
* See https://reactnative.dev/docs/animated#decay
72+
*/
4773
export const decay = AnimatedImplementation.decay;
74+
75+
/**
76+
* Starts an animation after the given delay.
77+
*
78+
* See https://reactnative.dev/docs/animated#delay
79+
*/
4880
export const delay = AnimatedImplementation.delay;
81+
82+
/**
83+
* Create a new Animated value that is limited between 2 values. It uses the
84+
* difference between the last value so even if the value is far from the
85+
* bounds it will start changing when the value starts getting closer again.
86+
*
87+
* See https://reactnative.dev/docs/animated#diffclamp
88+
*/
4989
export const diffClamp = AnimatedImplementation.diffClamp;
90+
91+
/**
92+
* Creates a new Animated value composed by dividing the first Animated value
93+
* by the second Animated value.
94+
*
95+
* See https://reactnative.dev/docs/animated#divide
96+
*/
5097
export const divide = AnimatedImplementation.divide;
98+
99+
/**
100+
* Takes an array of mappings and extracts values from each arg accordingly,
101+
* then calls `setValue` on the mapped outputs.
102+
*
103+
* See https://reactnative.dev/docs/animated#event
104+
*/
51105
export const event = AnimatedImplementation.event;
106+
107+
/**
108+
* Advanced imperative API for snooping on animated events that are passed in
109+
* through props. Use values directly where possible.
110+
*
111+
* See https://reactnative.dev/docs/animated#forkevent
112+
*/
52113
export const forkEvent = AnimatedImplementation.forkEvent;
114+
115+
/**
116+
* Loops a given animation continuously, so that each time it reaches the
117+
* end, it resets and begins again from the start.
118+
*
119+
* See https://reactnative.dev/docs/animated#loop
120+
*/
53121
export const loop = AnimatedImplementation.loop;
122+
123+
/**
124+
* Creates a new Animated value that is the (non-negative) modulo of the
125+
* provided Animated value.
126+
*
127+
* See https://reactnative.dev/docs/animated#modulo
128+
*/
54129
export const modulo = AnimatedImplementation.modulo;
130+
131+
/**
132+
* Creates a new Animated value composed from two Animated values multiplied
133+
* together.
134+
*
135+
* See https://reactnative.dev/docs/animated#multiply
136+
*/
55137
export const multiply = AnimatedImplementation.multiply;
138+
139+
/**
140+
* Starts an array of animations all at the same time. By default, if one
141+
* of the animations is stopped, they will all be stopped. You can override
142+
* this with the `stopTogether` flag.
143+
*
144+
* See https://reactnative.dev/docs/animated#parallel
145+
*/
56146
export const parallel = AnimatedImplementation.parallel;
147+
148+
/**
149+
* Starts an array of animations in order, waiting for each to complete
150+
* before starting the next. If the current running animation is stopped, no
151+
* following animations will be started.
152+
*
153+
* See https://reactnative.dev/docs/animated#sequence
154+
*/
57155
export const sequence = AnimatedImplementation.sequence;
156+
157+
/**
158+
* Animates a value according to an analytical spring model based on
159+
* damped harmonic oscillation.
160+
*
161+
* See https://reactnative.dev/docs/animated#spring
162+
*/
58163
export const spring = AnimatedImplementation.spring;
164+
165+
/**
166+
* Array of animations may run in parallel (overlap), but are started in
167+
* sequence with successive delays. Nice for doing trailing effects.
168+
*
169+
* See https://reactnative.dev/docs/animated#stagger
170+
*/
59171
export const stagger = AnimatedImplementation.stagger;
172+
173+
/**
174+
* Creates a new Animated value composed by subtracting the second Animated
175+
* value from the first Animated value.
176+
*
177+
* See https://reactnative.dev/docs/animated#subtract
178+
*/
60179
export const subtract = AnimatedImplementation.subtract;
180+
181+
/**
182+
* Animates a value along a timed easing curve. The Easing module has tons of
183+
* predefined curves, or you can use your own function.
184+
*
185+
* See https://reactnative.dev/docs/animated#timing
186+
*/
61187
export const timing = AnimatedImplementation.timing;
62188
export const unforkEvent = AnimatedImplementation.unforkEvent;

packages/react-native/Libraries/Animated/AnimatedImplementation.js

Lines changed: 0 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -606,144 +606,23 @@ export default {
606606
* See https://reactnative.dev/docs/animated#node
607607
*/
608608
Node: AnimatedNode,
609-
610-
/**
611-
* Animates a value from an initial velocity to zero based on a decay
612-
* coefficient.
613-
*
614-
* See https://reactnative.dev/docs/animated#decay
615-
*/
616609
decay,
617-
/**
618-
* Animates a value along a timed easing curve. The Easing module has tons of
619-
* predefined curves, or you can use your own function.
620-
*
621-
* See https://reactnative.dev/docs/animated#timing
622-
*/
623610
timing,
624-
/**
625-
* Animates a value according to an analytical spring model based on
626-
* damped harmonic oscillation.
627-
*
628-
* See https://reactnative.dev/docs/animated#spring
629-
*/
630611
spring,
631-
632-
/**
633-
* Creates a new Animated value composed from two Animated values added
634-
* together.
635-
*
636-
* See https://reactnative.dev/docs/animated#add
637-
*/
638612
add,
639-
640-
/**
641-
* Creates a new Animated value composed by subtracting the second Animated
642-
* value from the first Animated value.
643-
*
644-
* See https://reactnative.dev/docs/animated#subtract
645-
*/
646613
subtract,
647-
648-
/**
649-
* Creates a new Animated value composed by dividing the first Animated value
650-
* by the second Animated value.
651-
*
652-
* See https://reactnative.dev/docs/animated#divide
653-
*/
654614
divide,
655-
656-
/**
657-
* Creates a new Animated value composed from two Animated values multiplied
658-
* together.
659-
*
660-
* See https://reactnative.dev/docs/animated#multiply
661-
*/
662615
multiply,
663-
664-
/**
665-
* Creates a new Animated value that is the (non-negative) modulo of the
666-
* provided Animated value.
667-
*
668-
* See https://reactnative.dev/docs/animated#modulo
669-
*/
670616
modulo,
671-
672-
/**
673-
* Create a new Animated value that is limited between 2 values. It uses the
674-
* difference between the last value so even if the value is far from the
675-
* bounds it will start changing when the value starts getting closer again.
676-
*
677-
* See https://reactnative.dev/docs/animated#diffclamp
678-
*/
679617
diffClamp,
680-
681-
/**
682-
* Starts an animation after the given delay.
683-
*
684-
* See https://reactnative.dev/docs/animated#delay
685-
*/
686618
delay,
687-
/**
688-
* Starts an array of animations in order, waiting for each to complete
689-
* before starting the next. If the current running animation is stopped, no
690-
* following animations will be started.
691-
*
692-
* See https://reactnative.dev/docs/animated#sequence
693-
*/
694619
sequence,
695-
/**
696-
* Starts an array of animations all at the same time. By default, if one
697-
* of the animations is stopped, they will all be stopped. You can override
698-
* this with the `stopTogether` flag.
699-
*
700-
* See https://reactnative.dev/docs/animated#parallel
701-
*/
702620
parallel,
703-
/**
704-
* Array of animations may run in parallel (overlap), but are started in
705-
* sequence with successive delays. Nice for doing trailing effects.
706-
*
707-
* See https://reactnative.dev/docs/animated#stagger
708-
*/
709621
stagger,
710-
/**
711-
* Loops a given animation continuously, so that each time it reaches the
712-
* end, it resets and begins again from the start.
713-
*
714-
* See https://reactnative.dev/docs/animated#loop
715-
*/
716622
loop,
717-
718-
/**
719-
* Takes an array of mappings and extracts values from each arg accordingly,
720-
* then calls `setValue` on the mapped outputs.
721-
*
722-
* See https://reactnative.dev/docs/animated#event
723-
*/
724623
event,
725-
726-
/**
727-
* Make any React component Animatable. Used to create `Animated.View`, etc.
728-
*
729-
* See https://reactnative.dev/docs/animated#createanimatedcomponent
730-
*/
731624
createAnimatedComponent,
732-
733-
/**
734-
* Imperative API to attach an animated value to an event on a view. Prefer
735-
* using `Animated.event` with `useNativeDrive: true` if possible.
736-
*
737-
* See https://reactnative.dev/docs/animated#attachnativeevent
738-
*/
739625
attachNativeEvent,
740-
741-
/**
742-
* Advanced imperative API for snooping on animated events that are passed in
743-
* through props. Use values directly where possible.
744-
*
745-
* See https://reactnative.dev/docs/animated#forkevent
746-
*/
747626
forkEvent,
748627
unforkEvent,
749628

0 commit comments

Comments
 (0)