addimated
Version:
An always interruptable, declarative animation library for React
91 lines (72 loc) • 2.93 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AnimatedWithChildren = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _invariant = _interopRequireDefault(require("invariant"));
var _warning = _interopRequireDefault(require("warning"));
var _Animated2 = require("./Animated");
var AnimatedWithChildren =
/*#__PURE__*/
function (_Animated) {
(0, _inherits2.default)(AnimatedWithChildren, _Animated);
function AnimatedWithChildren() {
var _this;
(0, _classCallCheck2.default)(this, AnimatedWithChildren);
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(AnimatedWithChildren).call(this));
_this.children = new Set();
return _this;
} // stubbed methods
(0, _createClass2.default)(AnimatedWithChildren, [{
key: "__attach",
value: function __attach() {
!false ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, "__attach is not implemented") : invariant(false) : void 0;
}
}, {
key: "__detach",
value: function __detach() {
!false ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, "__detach is not implemented") : invariant(false) : void 0;
}
}, {
key: "__getValue",
value: function __getValue() {
!false ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, "__getValue is not implemented") : invariant(false) : void 0;
}
}, {
key: "__getAnimatedValue",
value: function __getAnimatedValue() {
return this.__getValue();
} // implemented methods
}, {
key: "__addChild",
value: function __addChild(child) {
if (this.children.size === 0) {
this.__attach();
}
this.children.add(child);
}
}, {
key: "__removeChild",
value: function __removeChild(child) {
var success = this.children.delete(child);
process.env.NODE_ENV !== "production" ? (0, _warning.default)(success, "Attempted to remove child that doesn't exist") : void 0;
if (this.children.size === 0) {
this.__detach();
}
}
}, {
key: "__getChildren",
value: function __getChildren() {
return this.children;
}
}]);
return AnimatedWithChildren;
}(_Animated2.Animated);
exports.AnimatedWithChildren = AnimatedWithChildren;
//# sourceMappingURL=AnimatedWithChildren.js.map