UNPKG

@tamagui/react-native-web-lite

Version:
105 lines (104 loc) 4.71 kB
"use strict"; 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 Animation_exports = {}; __export(Animation_exports, { default: () => Animation_default }); module.exports = __toCommonJS(Animation_exports); var import_NativeAnimatedHelper = __toESM(require("../NativeAnimatedHelper")); 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; } var startNativeAnimationNextId = 1, Animation = /* @__PURE__ */ function() { function Animation2() { _class_call_check(this, Animation2), _define_property(this, "__active", void 0), _define_property(this, "__isInteraction", void 0), _define_property(this, "__nativeId", void 0), _define_property(this, "__onEnd", void 0), _define_property(this, "__iterations", void 0); } return _create_class(Animation2, [ { key: "start", value: function(fromValue, onUpdate, onEnd, previousAnimation, animatedValue) { } }, { key: "stop", value: function() { this.__nativeId && import_NativeAnimatedHelper.default.API.stopAnimation(this.__nativeId); } }, { key: "__getNativeAnimationConfig", value: function() { throw new Error("This animation type cannot be offloaded to native"); } }, { // Helper function for subclasses to make sure onEnd is only called once. key: "__debouncedOnEnd", value: function(result) { var onEnd = this.__onEnd; this.__onEnd = null, onEnd && onEnd(result); } }, { key: "__startNativeAnimation", value: function(animatedValue) { var startNativeAnimationWaitId = `${startNativeAnimationNextId}:startAnimation`; startNativeAnimationNextId += 1, import_NativeAnimatedHelper.default.API.setWaitingForIdentifier(startNativeAnimationWaitId); try { var config = this.__getNativeAnimationConfig(); animatedValue.__makeNative(config.platformConfig), this.__nativeId = import_NativeAnimatedHelper.default.generateNewAnimationId(), import_NativeAnimatedHelper.default.API.startAnimatingNode( this.__nativeId, animatedValue.__getNativeTag(), config, // $FlowFixMe[method-unbinding] added when improving typing for this parameters this.__debouncedOnEnd.bind(this) ); } catch (e) { throw e; } finally { import_NativeAnimatedHelper.default.API.unsetWaitingForIdentifier(startNativeAnimationWaitId); } } } ]), Animation2; }(), Animation_default = Animation; //# sourceMappingURL=Animation.js.map