@tamagui/react-native-web-lite
Version:
React Native for Web
71 lines (70 loc) • 3.21 kB
JavaScript
;
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf,
__hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all) __defProp(target, name, {
get: all[name],
enumerable: !0
});
},
__copyProps = (to, from, except, desc) => {
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
get: () => from[key],
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: !0
}) : target, mod)),
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
value: !0
}), mod);
var AnimatedWithChildren_exports = {};
__export(AnimatedWithChildren_exports, {
default: () => AnimatedWithChildren_default
});
module.exports = __toCommonJS(AnimatedWithChildren_exports);
var import_AnimatedNode = __toESM(require("./AnimatedNode.cjs")),
import_NativeAnimatedHelper = __toESM(require("../NativeAnimatedHelper.cjs"));
class AnimatedWithChildren extends import_AnimatedNode.default {
_children;
constructor() {
super(), this._children = [];
}
__makeNative(platformConfig) {
if (!this.__isNative) {
this.__isNative = !0;
for (const child of this._children) child.__makeNative(platformConfig), import_NativeAnimatedHelper.default.API.connectAnimatedNodes(this.__getNativeTag(), child.__getNativeTag());
}
super.__makeNative(platformConfig);
}
__addChild(child) {
this._children.length === 0 && this.__attach(), this._children.push(child), this.__isNative && (child.__makeNative(this.__getPlatformConfig()), import_NativeAnimatedHelper.default.API.connectAnimatedNodes(this.__getNativeTag(), child.__getNativeTag()));
}
__removeChild(child) {
const index = this._children.indexOf(child);
if (index === -1) {
console.warn("Trying to remove a child that doesn't exist");
return;
}
this.__isNative && child.__isNative && import_NativeAnimatedHelper.default.API.disconnectAnimatedNodes(this.__getNativeTag(), child.__getNativeTag()), this._children.splice(index, 1), this._children.length === 0 && this.__detach();
}
__getChildren() {
return this._children;
}
__callListeners(value) {
if (super.__callListeners(value), !this.__isNative) for (const child of this._children) child.__getValue && child.__callListeners(child.__getValue());
}
}
var AnimatedWithChildren_default = AnimatedWithChildren;