UNPKG

react-native-reanimated

Version:

More powerful alternative to Animated library for React Native.

20 lines (17 loc) 594 B
'use strict'; import type { CSSTransitionBehavior } from '../../../types'; import { VALID_TRANSITION_BEHAVIORS } from './constants'; export const ERROR_MESSAGES = { invalidTransitionBehavior: (behavior: CSSTransitionBehavior) => `Invalid transition behavior "${behavior}".`, }; export function normalizeTransitionBehavior( behavior: CSSTransitionBehavior = 'normal' ): boolean { if (!VALID_TRANSITION_BEHAVIORS.includes(behavior)) { throw new Error( `[Reanimated] ${ERROR_MESSAGES.invalidTransitionBehavior(behavior)}` ); } return behavior === 'allow-discrete'; }