addimated
Version:
An always interruptable, declarative animation library for React
77 lines (66 loc) • 2.38 kB
JavaScript
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import invariant from "invariant";
import warning from "warning";
import { Animated } from "./Animated";
var AnimatedWithChildren =
/*#__PURE__*/
function (_Animated) {
_inherits(AnimatedWithChildren, _Animated);
function AnimatedWithChildren() {
var _this;
_classCallCheck(this, AnimatedWithChildren);
_this = _possibleConstructorReturn(this, _getPrototypeOf(AnimatedWithChildren).call(this));
_this.children = new Set();
return _this;
} // stubbed methods
_createClass(AnimatedWithChildren, [{
key: "__attach",
value: function __attach() {
!false ? process.env.NODE_ENV !== "production" ? invariant(false, "__attach is not implemented") : invariant(false) : void 0;
}
}, {
key: "__detach",
value: function __detach() {
!false ? process.env.NODE_ENV !== "production" ? invariant(false, "__detach is not implemented") : invariant(false) : void 0;
}
}, {
key: "__getValue",
value: function __getValue() {
!false ? process.env.NODE_ENV !== "production" ? invariant(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" ? warning(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;
}(Animated);
export { AnimatedWithChildren };
//# sourceMappingURL=AnimatedWithChildren.js.map