UNPKG

antd

Version:

An enterprise-class UI design language and React components implementation

36 lines 813 B
import { isPlainObject } from '../../_util/is'; import { getTransitionName } from '../../_util/motion'; const motion = { motionAppear: false, motionEnter: true, motionLeave: true }; export default function useAnimateConfig(prefixCls, animated = { inkBar: true, tabPane: false }) { let mergedAnimated; if (animated === false) { mergedAnimated = { inkBar: false, tabPane: false }; } else if (animated === true) { mergedAnimated = { inkBar: true, tabPane: true }; } else { mergedAnimated = { inkBar: true, ...(isPlainObject(animated) ? animated : {}) }; } if (mergedAnimated.tabPane) { mergedAnimated.tabPaneMotion = { ...motion, motionName: getTransitionName(prefixCls, 'switch') }; } return mergedAnimated; }