UNPKG

@tamagui/react-native-web-lite

Version:
75 lines (74 loc) 3.2 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")); let startNativeAnimationNextId = 1; class Animation { __active; __isInteraction; __nativeId; __onEnd; __iterations; start(fromValue, onUpdate, onEnd, previousAnimation, animatedValue) { } stop() { this.__nativeId && import_NativeAnimatedHelper.default.API.stopAnimation(this.__nativeId); } __getNativeAnimationConfig() { throw new Error("This animation type cannot be offloaded to native"); } // Helper function for subclasses to make sure onEnd is only called once. __debouncedOnEnd(result) { const onEnd = this.__onEnd; this.__onEnd = null, onEnd && onEnd(result); } __startNativeAnimation(animatedValue) { const startNativeAnimationWaitId = `${startNativeAnimationNextId}:startAnimation`; startNativeAnimationNextId += 1, import_NativeAnimatedHelper.default.API.setWaitingForIdentifier( startNativeAnimationWaitId ); try { const 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 ); } } } var Animation_default = Animation; //# sourceMappingURL=Animation.js.map