UNPKG

@tamagui/react-native-web-lite

Version:
159 lines (157 loc) 7.06 kB
import AnimatedNode from "./AnimatedNode.native.js"; import NativeAnimatedHelper from "../NativeAnimatedHelper.native.js"; function _assert_this_initialized(self) { if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return self; } function _call_super(_this, derived, args) { return derived = _get_prototype_of(derived), _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args)); } function _class_call_check(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); } } function _create_class(Constructor, protoProps, staticProps) { return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Constructor; } function _define_property(obj, key, value) { return key in obj ? Object.defineProperty(obj, key, { value, enumerable: !0, configurable: !0, writable: !0 }) : obj[key] = value, obj; } function _get(target, property, receiver) { return typeof Reflect < "u" && Reflect.get ? _get = Reflect.get : _get = function (target2, property2, receiver2) { var base = _super_prop_base(target2, property2); if (base) { var desc = Object.getOwnPropertyDescriptor(base, property2); return desc.get ? desc.get.call(receiver2 || target2) : desc.value; } }, _get(target, property, receiver || target); } function _get_prototype_of(o) { return _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function (o2) { return o2.__proto__ || Object.getPrototypeOf(o2); }, _get_prototype_of(o); } function _inherits(subClass, superClass) { if (typeof superClass != "function" && superClass !== null) throw new TypeError("Super expression must either be null or a function"); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: !0, configurable: !0 } }), superClass && _set_prototype_of(subClass, superClass); } function _possible_constructor_return(self, call) { return call && (_type_of(call) === "object" || typeof call == "function") ? call : _assert_this_initialized(self); } function _set_prototype_of(o, p) { return _set_prototype_of = Object.setPrototypeOf || function (o2, p2) { return o2.__proto__ = p2, o2; }, _set_prototype_of(o, p); } function _super_prop_base(object, property) { for (; !Object.prototype.hasOwnProperty.call(object, property) && (object = _get_prototype_of(object), object !== null);); return object; } function _type_of(obj) { "@swc/helpers - typeof"; return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj; } function _is_native_reflect_construct() { try { var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch {} return (_is_native_reflect_construct = function () { return !!result; })(); } var AnimatedWithChildren = /* @__PURE__ */function (AnimatedNode2) { _inherits(AnimatedWithChildren2, AnimatedNode2); function AnimatedWithChildren2() { _class_call_check(this, AnimatedWithChildren2); var _this; return _this = _call_super(this, AnimatedWithChildren2), _define_property(_this, "_children", void 0), _this._children = [], _this; } return _create_class(AnimatedWithChildren2, [{ key: "__makeNative", value: function (platformConfig) { if (!this.__isNative) { this.__isNative = !0; var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { for (var _iterator = this._children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) { var child = _step.value; child.__makeNative(platformConfig), NativeAnimatedHelper.API.connectAnimatedNodes(this.__getNativeTag(), child.__getNativeTag()); } } catch (err) { _didIteratorError = !0, _iteratorError = err; } finally { try { !_iteratorNormalCompletion && _iterator.return != null && _iterator.return(); } finally { if (_didIteratorError) throw _iteratorError; } } } _get(_get_prototype_of(AnimatedWithChildren2.prototype), "__makeNative", this).call(this, platformConfig); } }, { key: "__addChild", value: function (child) { this._children.length === 0 && this.__attach(), this._children.push(child), this.__isNative && (child.__makeNative(this.__getPlatformConfig()), NativeAnimatedHelper.API.connectAnimatedNodes(this.__getNativeTag(), child.__getNativeTag())); } }, { key: "__removeChild", value: function (child) { var index = this._children.indexOf(child); if (index === -1) { console.warn("Trying to remove a child that doesn't exist"); return; } this.__isNative && child.__isNative && NativeAnimatedHelper.API.disconnectAnimatedNodes(this.__getNativeTag(), child.__getNativeTag()), this._children.splice(index, 1), this._children.length === 0 && this.__detach(); } }, { key: "__getChildren", value: function () { return this._children; } }, { key: "__callListeners", value: function (value) { if (_get(_get_prototype_of(AnimatedWithChildren2.prototype), "__callListeners", this).call(this, value), !this.__isNative) { var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { for (var _iterator = this._children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) { var child = _step.value; child.__getValue && child.__callListeners(child.__getValue()); } } catch (err) { _didIteratorError = !0, _iteratorError = err; } finally { try { !_iteratorNormalCompletion && _iterator.return != null && _iterator.return(); } finally { if (_didIteratorError) throw _iteratorError; } } } } }]), AnimatedWithChildren2; }(AnimatedNode), AnimatedWithChildren_default = AnimatedWithChildren; export { AnimatedWithChildren_default as default }; //# sourceMappingURL=AnimatedWithChildren.native.js.map