1
This commit is contained in:
+42
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = useAnimateConfig;
|
||||
var _warning = _interopRequireDefault(require("@rc-component/util/lib/warning"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function useAnimateConfig(animated = {
|
||||
inkBar: true,
|
||||
tabPane: false
|
||||
}) {
|
||||
let mergedAnimated;
|
||||
if (animated === false) {
|
||||
mergedAnimated = {
|
||||
inkBar: false,
|
||||
tabPane: false
|
||||
};
|
||||
} else if (animated === true) {
|
||||
mergedAnimated = {
|
||||
inkBar: true,
|
||||
tabPane: false
|
||||
};
|
||||
} else {
|
||||
mergedAnimated = {
|
||||
inkBar: true,
|
||||
...(typeof animated === 'object' ? animated : {})
|
||||
};
|
||||
}
|
||||
|
||||
// Enable tabPane animation if provide motion
|
||||
if (mergedAnimated.tabPaneMotion && mergedAnimated.tabPane === undefined) {
|
||||
mergedAnimated.tabPane = true;
|
||||
}
|
||||
if (!mergedAnimated.tabPaneMotion && mergedAnimated.tabPane) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
(0, _warning.default)(false, '`animated.tabPane` is true but `animated.tabPaneMotion` is not provided. Motion will not work.');
|
||||
}
|
||||
mergedAnimated.tabPane = false;
|
||||
}
|
||||
return mergedAnimated;
|
||||
}
|
||||
Reference in New Issue
Block a user