MCPcopy
hub / github.com/react-native-modal/react-native-modal / buildAnimations

Function buildAnimations

src/utils.ts:40–70  ·  view source on GitHub ↗
({
  animationIn,
  animationOut,
}: {
  animationIn: Animation | CustomAnimation;
  animationOut: Animation | CustomAnimation;
})

Source from the content-addressed store, hash-verified

38// User can define custom react-native-animatable animations, see PR #72
39// Utility for creating our own custom react-native-animatable animations
40export const buildAnimations = ({
41 animationIn,
42 animationOut,
43}: {
44 animationIn: Animation | CustomAnimation;
45 animationOut: Animation | CustomAnimation;
46}): Animations => {
47 let updatedAnimationIn: string;
48 let updatedAnimationOut: string;
49
50 if (isObject(animationIn)) {
51 const animationName = JSON.stringify(animationIn);
52 makeAnimation(animationName, animationIn as CustomAnimation);
53 updatedAnimationIn = animationName;
54 } else {
55 updatedAnimationIn = animationIn;
56 }
57
58 if (isObject(animationOut)) {
59 const animationName = JSON.stringify(animationOut);
60 makeAnimation(animationName, animationOut as CustomAnimation);
61 updatedAnimationOut = animationName;
62 } else {
63 updatedAnimationOut = animationOut;
64 }
65
66 return {
67 animationIn: updatedAnimationIn,
68 animationOut: updatedAnimationOut,
69 };
70};
71
72export const reversePercentage = (x: number) => -(x - 1);
73

Callers 2

constructorMethod · 0.90
componentDidUpdateMethod · 0.90

Calls 2

isObjectFunction · 0.85
makeAnimationFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…