UNPKG

create-expo-cljs-app

Version:

Create a react native application with Expo and Shadow-CLJS!

109 lines (79 loc) 4.14 kB
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * * @format */ 'use strict'; function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } import AnimatedNode from './AnimatedNode'; import NativeAnimatedHelper from '../NativeAnimatedHelper'; var AnimatedWithChildren = /*#__PURE__*/function (_AnimatedNode) { _inheritsLoose(AnimatedWithChildren, _AnimatedNode); function AnimatedWithChildren() { var _this; _this = _AnimatedNode.call(this) || this; _this._children = []; return _this; } var _proto = AnimatedWithChildren.prototype; _proto.__makeNative = function __makeNative() { if (!this.__isNative) { this.__isNative = true; for (var _iterator = _createForOfIteratorHelperLoose(this._children), _step; !(_step = _iterator()).done;) { var child = _step.value; child.__makeNative(); NativeAnimatedHelper.API.connectAnimatedNodes(this.__getNativeTag(), child.__getNativeTag()); } } _AnimatedNode.prototype.__makeNative.call(this); }; _proto.__addChild = function __addChild(child) { if (this._children.length === 0) { this.__attach(); } this._children.push(child); if (this.__isNative) { // Only accept "native" animated nodes as children child.__makeNative(); NativeAnimatedHelper.API.connectAnimatedNodes(this.__getNativeTag(), child.__getNativeTag()); } }; _proto.__removeChild = function __removeChild(child) { var index = this._children.indexOf(child); if (index === -1) { console.warn("Trying to remove a child that doesn't exist"); return; } if (this.__isNative && child.__isNative) { NativeAnimatedHelper.API.disconnectAnimatedNodes(this.__getNativeTag(), child.__getNativeTag()); } this._children.splice(index, 1); if (this._children.length === 0) { this.__detach(); } }; _proto.__getChildren = function __getChildren() { return this._children; }; _proto.__callListeners = function __callListeners(value) { _AnimatedNode.prototype.__callListeners.call(this, value); if (!this.__isNative) { for (var _iterator2 = _createForOfIteratorHelperLoose(this._children), _step2; !(_step2 = _iterator2()).done;) { var child = _step2.value; if (child.__getValue) { child.__callListeners(child.__getValue()); } } } }; return AnimatedWithChildren; }(AnimatedNode); export default AnimatedWithChildren;