@tamagui/react-native-web-lite
Version:
React Native for Web
64 lines (63 loc) • 2.63 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __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 __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
value: !0
}), mod);
var Animation_exports = {};
__export(Animation_exports, {
Animation: () => Animation,
default: () => Animation_default
});
module.exports = __toCommonJS(Animation_exports);
var import_NativeAnimatedHelper = require("../NativeAnimatedHelper.cjs");
let startNativeAnimationNextId = 1;
class Animation {
__active;
__isInteraction;
__nativeId;
__onEnd;
__iterations;
start(fromValue, onUpdate, onEnd, previousAnimation, animatedValue) {}
stop() {
this.__nativeId && import_NativeAnimatedHelper.NativeAnimatedHelper.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.NativeAnimatedHelper.API.setWaitingForIdentifier(startNativeAnimationWaitId);
try {
const config = this.__getNativeAnimationConfig();
animatedValue.__makeNative(config.platformConfig), this.__nativeId = import_NativeAnimatedHelper.NativeAnimatedHelper.generateNewAnimationId(), import_NativeAnimatedHelper.NativeAnimatedHelper.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.NativeAnimatedHelper.API.unsetWaitingForIdentifier(startNativeAnimationWaitId);
}
}
}
var Animation_default = Animation;