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

Function initializeAnimations

src/utils.ts:8–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6const {height, width} = Dimensions.get('window');
7
8export const initializeAnimations = () => {
9 // Since react-native-animatable applies by default a margin of 100 to its
10 // sliding animation, we reset them here overriding the margin to 0.
11 const animationDefinitions: Record<string, CustomAnimation> = {
12 slideInDown: makeSlideTranslation('translateY', -height, 0),
13 slideInUp: makeSlideTranslation('translateY', height, 0),
14 slideInLeft: makeSlideTranslation('translateX', -width, 0),
15 slideInRight: makeSlideTranslation('translateX', width, 0),
16 slideOutDown: makeSlideTranslation('translateY', 0, height),
17 slideOutUp: makeSlideTranslation('translateY', 0, -height),
18 slideOutLeft: makeSlideTranslation('translateX', 0, -width),
19 slideOutRight: makeSlideTranslation('translateX', 0, width),
20 };
21
22 animatable.initializeRegistryWithDefinitions(animationDefinitions);
23};
24
25export const makeSlideTranslation = (
26 translationType: string,

Callers 1

modal.tsxFile · 0.90

Calls 1

makeSlideTranslationFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…