Change Animated methods' local names to avoid symbol collisions in the API snapshot (#52219)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52219

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D77221690

fbshipit-source-id: 149711ee8c9d89c50178bf3d41de8b44fbc1d464
This commit is contained in:
Jakub Piasecki
2025-06-25 00:16:24 -07:00
committed by Facebook GitHub Bot
parent 4f94028ca6
commit fbd44ade3a
4 changed files with 84 additions and 84 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ export type EventConfig<T> = {
platformConfig?: PlatformConfig,
};
export function attachNativeEvent(
export function attachNativeEventImpl(
viewRef: any,
eventName: string,
argMapping: $ReadOnlyArray<?Mapping>,
@@ -181,7 +181,7 @@ export class AnimatedEvent {
'Only native driven events need to be attached.',
);
this._attachedEvent = attachNativeEvent(
this._attachedEvent = attachNativeEventImpl(
viewRef,
eventName,
this._argMapping,
@@ -20,7 +20,7 @@ import type {DecayAnimationConfig} from './animations/DecayAnimation';
import type {SpringAnimationConfig} from './animations/SpringAnimation';
import type {TimingAnimationConfig} from './animations/TimingAnimation';
import {AnimatedEvent, attachNativeEvent} from './AnimatedEvent';
import {AnimatedEvent, attachNativeEventImpl} from './AnimatedEvent';
import DecayAnimation from './animations/DecayAnimation';
import SpringAnimation from './animations/SpringAnimation';
import TimingAnimation from './animations/TimingAnimation';
@@ -47,39 +47,39 @@ export type CompositeAnimation = {
...
};
const add = function (
const addImpl = function (
a: AnimatedNode | number,
b: AnimatedNode | number,
): AnimatedAddition {
return new AnimatedAddition(a, b);
};
const subtract = function (
const subtractImpl = function (
a: AnimatedNode | number,
b: AnimatedNode | number,
): AnimatedSubtraction {
return new AnimatedSubtraction(a, b);
};
const divide = function (
const divideImpl = function (
a: AnimatedNode | number,
b: AnimatedNode | number,
): AnimatedDivision {
return new AnimatedDivision(a, b);
};
const multiply = function (
const multiplyImpl = function (
a: AnimatedNode | number,
b: AnimatedNode | number,
): AnimatedMultiplication {
return new AnimatedMultiplication(a, b);
};
const modulo = function (a: AnimatedNode, modulus: number): AnimatedModulo {
const moduloImpl = function (a: AnimatedNode, modulus: number): AnimatedModulo {
return new AnimatedModulo(a, modulus);
};
const diffClamp = function (
const diffClampImpl = function (
a: AnimatedNode,
min: number,
max: number,
@@ -120,7 +120,7 @@ const maybeVectorAnim = function (
const aY = anim((value: AnimatedValueXY).y, configY);
// We use `stopTogether: false` here because otherwise tracking will break
// because the second animation will get stopped before it can update.
return parallel([aX, aY], {stopTogether: false});
return parallelImpl([aX, aY], {stopTogether: false});
} else if (value instanceof AnimatedColor) {
const configR = {...config};
const configG = {...config};
@@ -146,12 +146,12 @@ const maybeVectorAnim = function (
const aA = anim((value: AnimatedColor).a, configA);
// We use `stopTogether: false` here because otherwise tracking will break
// because the second animation will get stopped before it can update.
return parallel([aR, aG, aB, aA], {stopTogether: false});
return parallelImpl([aR, aG, aB, aA], {stopTogether: false});
}
return null;
};
const spring = function (
const springImpl = function (
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
config: SpringAnimationConfig,
): CompositeAnimation {
@@ -179,7 +179,7 @@ const spring = function (
}
};
return (
maybeVectorAnim(value, config, spring) || {
maybeVectorAnim(value, config, springImpl) || {
start: function (callback?: ?EndCallback): void {
start(value, config, callback);
},
@@ -204,7 +204,7 @@ const spring = function (
);
};
const timing = function (
const timingImpl = function (
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
config: TimingAnimationConfig,
): CompositeAnimation {
@@ -233,7 +233,7 @@ const timing = function (
};
return (
maybeVectorAnim(value, config, timing) || {
maybeVectorAnim(value, config, timingImpl) || {
start: function (callback?: ?EndCallback, isLooping?: boolean): void {
start(value, {...config, isLooping}, callback);
},
@@ -258,7 +258,7 @@ const timing = function (
);
};
const decay = function (
const decayImpl = function (
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
config: DecayAnimationConfig,
): CompositeAnimation {
@@ -275,7 +275,7 @@ const decay = function (
};
return (
maybeVectorAnim(value, config, decay) || {
maybeVectorAnim(value, config, decayImpl) || {
start: function (callback?: ?EndCallback): void {
start(value, config, callback);
},
@@ -300,7 +300,7 @@ const decay = function (
);
};
const sequence = function (
const sequenceImpl = function (
animations: Array<CompositeAnimation>,
): CompositeAnimation {
let current = 0;
@@ -363,7 +363,7 @@ type ParallelConfig = {
stopTogether?: boolean,
...
};
const parallel = function (
const parallelImpl = function (
animations: Array<CompositeAnimation>,
config?: ?ParallelConfig,
): CompositeAnimation {
@@ -431,9 +431,9 @@ const parallel = function (
return result;
};
const delay = function (time: number): CompositeAnimation {
const delayImpl = function (time: number): CompositeAnimation {
// Would be nice to make a specialized implementation
return timing(new AnimatedValue(0), {
return timingImpl(new AnimatedValue(0), {
toValue: 0,
delay: time,
duration: 0,
@@ -441,13 +441,13 @@ const delay = function (time: number): CompositeAnimation {
});
};
const stagger = function (
const staggerImpl = function (
time: number,
animations: Array<CompositeAnimation>,
): CompositeAnimation {
return parallel(
return parallelImpl(
animations.map((animation, i) => {
return sequence([delay(time * i), animation]);
return sequenceImpl([delayImpl(time * i), animation]);
}),
);
};
@@ -458,7 +458,7 @@ type LoopAnimationConfig = {
...
};
const loop = function (
const loopImpl = function (
animation: CompositeAnimation,
// $FlowFixMe[prop-missing]
{iterations = -1, resetBeforeIteration = true}: LoopAnimationConfig = {},
@@ -514,7 +514,7 @@ const loop = function (
};
};
function forkEvent(
function forkEventImpl(
event: ?AnimatedEvent | ?Function,
listener: Function,
): AnimatedEvent | Function {
@@ -531,7 +531,7 @@ function forkEvent(
}
}
function unforkEvent(
function unforkEventImpl(
event: ?AnimatedEvent | ?Function,
listener: Function,
): void {
@@ -540,7 +540,7 @@ function unforkEvent(
}
}
const event = function <T>(
const eventImpl = function <T>(
argMapping: $ReadOnlyArray<?Mapping>,
config: EventConfig<T>,
): any {
@@ -606,25 +606,25 @@ export default {
* See https://reactnative.dev/docs/animated#node
*/
Node: AnimatedNode,
decay,
timing,
spring,
add,
subtract,
divide,
multiply,
modulo,
diffClamp,
delay,
sequence,
parallel,
stagger,
loop,
event,
decay: decayImpl,
timing: timingImpl,
spring: springImpl,
add: addImpl,
subtract: subtractImpl,
divide: divideImpl,
multiply: multiplyImpl,
modulo: moduloImpl,
diffClamp: diffClampImpl,
delay: delayImpl,
sequence: sequenceImpl,
parallel: parallelImpl,
stagger: staggerImpl,
loop: loopImpl,
event: eventImpl,
createAnimatedComponent,
attachNativeEvent,
forkEvent,
unforkEvent,
attachNativeEvent: attachNativeEventImpl,
forkEvent: forkEventImpl,
unforkEvent: unforkEventImpl,
/**
* Expose Event class, so it can be used as a type for type checkers.
+2 -2
View File
@@ -17,7 +17,7 @@ import type {DecayAnimationConfig} from './animations/DecayAnimation';
import type {SpringAnimationConfig} from './animations/SpringAnimation';
import type {TimingAnimationConfig} from './animations/TimingAnimation';
import {AnimatedEvent, attachNativeEvent} from './AnimatedEvent';
import {AnimatedEvent, attachNativeEventImpl} from './AnimatedEvent';
import AnimatedImplementation from './AnimatedImplementation';
import createAnimatedComponent from './createAnimatedComponent';
import AnimatedColor from './nodes/AnimatedColor';
@@ -188,7 +188,7 @@ export default {
loop,
event: AnimatedImplementation.event,
createAnimatedComponent,
attachNativeEvent,
attachNativeEvent: attachNativeEventImpl,
forkEvent: AnimatedImplementation.forkEvent,
unforkEvent: AnimatedImplementation.unforkEvent,
Event: AnimatedEvent,
@@ -136,7 +136,7 @@ export type EventConfig<T> = {
useNativeDriver: boolean,
platformConfig?: PlatformConfig,
};
declare export function attachNativeEvent(
declare export function attachNativeEventImpl(
viewRef: any,
eventName: string,
argMapping: $ReadOnlyArray<?Mapping>,
@@ -226,53 +226,53 @@ exports[`public API should not change unintentionally Libraries/Animated/Animate
reset: () => void,
...
};
declare const add: (
declare const addImpl: (
a: AnimatedNode | number,
b: AnimatedNode | number
) => AnimatedAddition;
declare const subtract: (
declare const subtractImpl: (
a: AnimatedNode | number,
b: AnimatedNode | number
) => AnimatedSubtraction;
declare const divide: (
declare const divideImpl: (
a: AnimatedNode | number,
b: AnimatedNode | number
) => AnimatedDivision;
declare const multiply: (
declare const multiplyImpl: (
a: AnimatedNode | number,
b: AnimatedNode | number
) => AnimatedMultiplication;
declare const modulo: (a: AnimatedNode, modulus: number) => AnimatedModulo;
declare const diffClamp: (
declare const moduloImpl: (a: AnimatedNode, modulus: number) => AnimatedModulo;
declare const diffClampImpl: (
a: AnimatedNode,
min: number,
max: number
) => AnimatedDiffClamp;
declare const spring: (
declare const springImpl: (
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
config: SpringAnimationConfig
) => CompositeAnimation;
declare const timing: (
declare const timingImpl: (
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
config: TimingAnimationConfig
) => CompositeAnimation;
declare const decay: (
declare const decayImpl: (
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
config: DecayAnimationConfig
) => CompositeAnimation;
declare const sequence: (
declare const sequenceImpl: (
animations: Array<CompositeAnimation>
) => CompositeAnimation;
type ParallelConfig = {
stopTogether?: boolean,
...
};
declare const parallel: (
declare const parallelImpl: (
animations: Array<CompositeAnimation>,
config?: ?ParallelConfig
) => CompositeAnimation;
declare const delay: (time: number) => CompositeAnimation;
declare const stagger: (
declare const delayImpl: (time: number) => CompositeAnimation;
declare const staggerImpl: (
time: number,
animations: Array<CompositeAnimation>
) => CompositeAnimation;
@@ -281,19 +281,19 @@ type LoopAnimationConfig = {
resetBeforeIteration?: boolean,
...
};
declare const loop: (
declare const loopImpl: (
animation: CompositeAnimation,
$$PARAM_1$$?: LoopAnimationConfig
) => CompositeAnimation;
declare function forkEvent(
declare function forkEventImpl(
event: ?AnimatedEvent | ?Function,
listener: Function
): AnimatedEvent | Function;
declare function unforkEvent(
declare function unforkEventImpl(
event: ?AnimatedEvent | ?Function,
listener: Function
): void;
declare const event: <T>(
declare const eventImpl: <T>(
argMapping: $ReadOnlyArray<?Mapping>,
config: EventConfig<T>
) => any;
@@ -313,25 +313,25 @@ declare export default {
Color: typeof AnimatedColor,
Interpolation: typeof AnimatedInterpolation,
Node: typeof AnimatedNode,
decay: typeof decay,
timing: typeof timing,
spring: typeof spring,
add: typeof add,
subtract: typeof subtract,
divide: typeof divide,
multiply: typeof multiply,
modulo: typeof modulo,
diffClamp: typeof diffClamp,
delay: typeof delay,
sequence: typeof sequence,
parallel: typeof parallel,
stagger: typeof stagger,
loop: typeof loop,
event: typeof event,
decay: typeof decayImpl,
timing: typeof timingImpl,
spring: typeof springImpl,
add: typeof addImpl,
subtract: typeof subtractImpl,
divide: typeof divideImpl,
multiply: typeof multiplyImpl,
modulo: typeof moduloImpl,
diffClamp: typeof diffClampImpl,
delay: typeof delayImpl,
sequence: typeof sequenceImpl,
parallel: typeof parallelImpl,
stagger: typeof staggerImpl,
loop: typeof loopImpl,
event: typeof eventImpl,
createAnimatedComponent: typeof createAnimatedComponent,
attachNativeEvent: typeof attachNativeEvent,
forkEvent: typeof forkEvent,
unforkEvent: typeof unforkEvent,
attachNativeEvent: typeof attachNativeEventImpl,
forkEvent: typeof forkEventImpl,
unforkEvent: typeof unforkEventImpl,
Event: typeof AnimatedEvent,
};
"