@tamagui/react-native-web-lite
Version:
React Native for Web
110 lines (109 loc) • 3.21 kB
JavaScript
import { AnimatedEvent, attachNativeEvent } from "./AnimatedEvent";
import AnimatedImplementation from "./AnimatedImplementation";
import createAnimatedComponent from "./createAnimatedComponent";
import AnimatedColor from "./nodes/AnimatedColor";
import AnimatedInterpolation from "./nodes/AnimatedInterpolation";
import AnimatedNode from "./nodes/AnimatedNode";
import AnimatedValue from "./nodes/AnimatedValue";
import AnimatedValueXY from "./nodes/AnimatedValueXY";
var inAnimationCallback = !1;
function mockAnimationStart(start) {
return (callback) => {
var guardedCallback = callback == null ? callback : function() {
if (inAnimationCallback) {
console.warn(
"Ignoring recursive animation callback when running mock animations"
);
return;
}
inAnimationCallback = !0;
try {
callback(...arguments);
} finally {
inAnimationCallback = !1;
}
};
start(guardedCallback);
};
}
var emptyAnimation = {
start: () => {
},
stop: () => {
},
reset: () => {
},
_startNativeLoop: () => {
},
_isUsingNativeDriver: () => !1
}, mockCompositeAnimation = (animations) => ({
...emptyAnimation,
start: mockAnimationStart((callback) => {
animations.forEach((animation) => animation.start()), callback?.({
finished: !0
});
})
}), spring = function(value, config) {
var anyValue = value;
return {
...emptyAnimation,
start: mockAnimationStart((callback) => {
anyValue.setValue(config.toValue), callback?.({
finished: !0
});
})
};
}, timing = function(value, config) {
var anyValue = value;
return {
...emptyAnimation,
start: mockAnimationStart((callback) => {
anyValue.setValue(config.toValue), callback?.({
finished: !0
});
})
};
}, decay = function(value, config) {
return emptyAnimation;
}, sequence = function(animations) {
return mockCompositeAnimation(animations);
}, parallel = function(animations, config) {
return mockCompositeAnimation(animations);
}, delay = function(time) {
return emptyAnimation;
}, stagger = function(time, animations) {
return mockCompositeAnimation(animations);
}, loop = function(animation, _temp) {
var _ref = _temp === void 0 ? {} : _temp, _ref$iterations = _ref.iterations, iterations = _ref$iterations === void 0 ? -1 : _ref$iterations;
return emptyAnimation;
}, AnimatedMock_default = {
Value: AnimatedValue,
ValueXY: AnimatedValueXY,
Color: AnimatedColor,
Interpolation: AnimatedInterpolation,
Node: AnimatedNode,
decay,
timing,
spring,
add: AnimatedImplementation.add,
subtract: AnimatedImplementation.subtract,
divide: AnimatedImplementation.divide,
multiply: AnimatedImplementation.multiply,
modulo: AnimatedImplementation.modulo,
diffClamp: AnimatedImplementation.diffClamp,
delay,
sequence,
parallel,
stagger,
loop,
event: AnimatedImplementation.event,
createAnimatedComponent,
attachNativeEvent,
forkEvent: AnimatedImplementation.forkEvent,
unforkEvent: AnimatedImplementation.unforkEvent,
Event: AnimatedEvent
};
export {
AnimatedMock_default as default
};
//# sourceMappingURL=AnimatedMock.js.map