351 lines
9.3 KiB
JavaScript
351 lines
9.3 KiB
JavaScript
// Metro module 356 (f357).
|
|
import _classCallCheck from "./_classCallCheck";
|
|
import _createClass from "./_createClass";
|
|
import _possibleConstructorReturn from "./_possibleConstructorReturn";
|
|
import _getPrototypeOf from "./_getPrototypeOf";
|
|
import _get from "./_get";
|
|
import _inherits from "./_inherits";
|
|
import Module357 from "./Module357";
|
|
import mapStringToNumericComponents from "./mapStringToNumericComponents";
|
|
import AnimatedWithChildren from "./AnimatedWithChildren";
|
|
function $mk66225($env) {
|
|
return function(a0) {
|
|
const r0 = $env;
|
|
return r0[1].apply(r0[0], a0);
|
|
};
|
|
}
|
|
function $mk66226($env) {
|
|
return function findAnimatedStyles(a0) {
|
|
const r1 = $env;
|
|
if (typeof a0.update === "function") {
|
|
r1[0].add(a0);
|
|
} else {
|
|
a0.__getChildren().forEach(r1[1]);
|
|
}
|
|
};
|
|
}
|
|
function $mk66227() {
|
|
return (a0) => a0.update();
|
|
}
|
|
let AnimatedValue;
|
|
let env370 = {};
|
|
env370[6] = function _isNativeReflectConstruct() {
|
|
let c12272_0;
|
|
try {
|
|
c12272_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
} catch ($e) {}
|
|
const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() {
|
|
return !!c12272_0;
|
|
};
|
|
env370[6] = _isNativeReflectConstruct2;
|
|
return _isNativeReflectConstruct2();
|
|
};
|
|
AnimatedValue = function AnimatedValue(a0, a1) {
|
|
_classCallCheck(this, AnimatedValue);
|
|
const r10 = [a1];
|
|
const r9 = _getPrototypeOf(AnimatedValue);
|
|
const r27 = _possibleConstructorReturn(this, (0, env370[6])() ? Reflect.construct(r9, r10, _getPrototypeOf(this).constructor) : r9.apply(this, r10));
|
|
if (typeof a0 !== "number") {
|
|
throw new Error("AnimatedValue: Attempting to set value to undefined");
|
|
}
|
|
r27._listenerCount = 0;
|
|
r27._updateSubscription = null;
|
|
r27._value = a0;
|
|
r27._startingValue = a0;
|
|
r27._offset = 0;
|
|
r27._animation = null;
|
|
if (a1 ? a1.useNativeDriver : a1) {
|
|
r27.__makeNative();
|
|
}
|
|
return r27;
|
|
};
|
|
_inherits(AnimatedValue, AnimatedWithChildren);
|
|
export default _createClass(AnimatedValue, [{
|
|
key: "__detach",
|
|
value: function __detach() {
|
|
const _this = this;
|
|
if (this.__isNative) {
|
|
Module357.API.getValue(this.__getNativeTag(), (a0) => {
|
|
_this._value = a0 - _this._offset;
|
|
});
|
|
}
|
|
let env23690;
|
|
this.stopAnimation();
|
|
const r20 = env23690 = {};
|
|
env23690[0] = this;
|
|
env23690[1] = void 0;
|
|
let r27 = _get(_getPrototypeOf(AnimatedValue.prototype), "__detach", this);
|
|
env23690[1] = r27;
|
|
if (typeof r27 === "function") {
|
|
r27 = $mk66225(r20);
|
|
}
|
|
r27([]);
|
|
}
|
|
}, {
|
|
key: "__getValue",
|
|
value: function __getValue() {
|
|
return this._value + this._offset;
|
|
}
|
|
}, {
|
|
key: "__makeNative",
|
|
value: function __makeNative(a0) {
|
|
let env23691;
|
|
const r7 = env23691 = {};
|
|
env23691[0] = this;
|
|
let r12 = _get(_getPrototypeOf(AnimatedValue.prototype), "__makeNative", this);
|
|
env23691[1] = r12;
|
|
if (typeof r12 === "function") {
|
|
r12 = $mk66225(r7);
|
|
}
|
|
r12([a0]);
|
|
if (this._listenerCount > 0) {
|
|
this.__ensureUpdateSubscriptionExists();
|
|
}
|
|
}
|
|
}, {
|
|
key: "addListener",
|
|
value: function addListener(a0) {
|
|
let env23692;
|
|
const r6 = env23692 = {};
|
|
env23692[0] = this;
|
|
let r11 = _get(_getPrototypeOf(AnimatedValue.prototype), "addListener", this);
|
|
env23692[1] = r11;
|
|
if (typeof r11 === "function") {
|
|
r11 = $mk66225(r6);
|
|
}
|
|
const r14 = r11([a0]);
|
|
this._listenerCount = this._listenerCount + 1;
|
|
if (this.__isNative) {
|
|
this.__ensureUpdateSubscriptionExists();
|
|
}
|
|
return r14;
|
|
}
|
|
}, {
|
|
key: "removeListener",
|
|
value: function removeListener(a0) {
|
|
let env23693;
|
|
const r8 = env23693 = {};
|
|
env23693[0] = this;
|
|
let r13 = _get(_getPrototypeOf(AnimatedValue.prototype), "removeListener", this);
|
|
env23693[1] = r13;
|
|
if (typeof r13 === "function") {
|
|
r13 = $mk66225(r8);
|
|
}
|
|
r13([a0]);
|
|
this._listenerCount = this._listenerCount - 1;
|
|
if (this.__isNative && this._listenerCount === 0) {
|
|
const _updateSubscription = this._updateSubscription;
|
|
if (_updateSubscription != null) {
|
|
_updateSubscription.remove();
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: "removeAllListeners",
|
|
value: function removeAllListeners() {
|
|
let env23694;
|
|
const r8 = env23694 = {};
|
|
env23694[0] = this;
|
|
let r13 = _get(_getPrototypeOf(AnimatedValue.prototype), "removeAllListeners", this);
|
|
env23694[1] = r13;
|
|
if (typeof r13 === "function") {
|
|
r13 = $mk66225(r8);
|
|
}
|
|
r13([]);
|
|
this._listenerCount = 0;
|
|
if (this.__isNative) {
|
|
const _updateSubscription = this._updateSubscription;
|
|
if (_updateSubscription != null) {
|
|
_updateSubscription.remove();
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: "__ensureUpdateSubscriptionExists",
|
|
value: function __ensureUpdateSubscriptionExists() {
|
|
let c23695_0, c23695_1;
|
|
if (this._updateSubscription == null) {
|
|
const r7 = this.__getNativeTag();
|
|
c23695_1 = r7;
|
|
Module357.API.startListeningToAnimatedNodeValue(r7);
|
|
c23695_0 = Module357.nativeEventEmitter.addListener("onAnimatedValueUpdate", (a0) => {
|
|
if (a0.tag === c23695_1) {
|
|
this.__onAnimatedValueUpdateReceived(a0.value, a0.offset);
|
|
}
|
|
});
|
|
this._updateSubscription = {
|
|
remove: () => {
|
|
if (this._updateSubscription != null) {
|
|
this._updateSubscription = null;
|
|
c23695_0.remove();
|
|
Module357.API.stopListeningToAnimatedNodeValue(c23695_1);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
}
|
|
}, {
|
|
key: "setValue",
|
|
value: function setValue(a0) {
|
|
if (this._animation) {
|
|
this._animation.stop();
|
|
this._animation = null;
|
|
}
|
|
this._updateValue(a0, !this.__isNative);
|
|
if (this.__isNative) {
|
|
const r19 = this.__getNativeTag().toString();
|
|
Module357.API.setWaitingForIdentifier(r19);
|
|
Module357.API.setAnimatedNodeValue(this.__getNativeTag(), a0);
|
|
Module357.API.unsetWaitingForIdentifier(r19);
|
|
}
|
|
}
|
|
}, {
|
|
key: "setOffset",
|
|
value: function setOffset(a0) {
|
|
this._offset = a0;
|
|
if (this.__isNative) {
|
|
Module357.API.setAnimatedNodeOffset(this.__getNativeTag(), a0);
|
|
}
|
|
}
|
|
}, {
|
|
key: "flattenOffset",
|
|
value: function flattenOffset() {
|
|
this._value = this._value + this._offset;
|
|
this._offset = 0;
|
|
if (this.__isNative) {
|
|
Module357.API.flattenAnimatedNodeOffset(this.__getNativeTag());
|
|
}
|
|
}
|
|
}, {
|
|
key: "extractOffset",
|
|
value: function extractOffset() {
|
|
this._offset = this._offset + this._value;
|
|
this._value = 0;
|
|
if (this.__isNative) {
|
|
const r14 = this.__getNativeTag().toString();
|
|
Module357.API.setWaitingForIdentifier(r14);
|
|
Module357.API.extractAnimatedNodeOffset(this.__getNativeTag());
|
|
Module357.API.unsetWaitingForIdentifier(r14);
|
|
}
|
|
}
|
|
}, {
|
|
key: "stopAnimation",
|
|
value: function stopAnimation(a0) {
|
|
this.stopTracking();
|
|
if (this._animation) {
|
|
this._animation.stop();
|
|
}
|
|
this._animation = null;
|
|
if (a0) {
|
|
if (this.__isNative) {
|
|
Module357.API.getValue(this.__getNativeTag(), a0);
|
|
} else {
|
|
a0(this.__getValue());
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: "resetAnimation",
|
|
value: function resetAnimation(a0) {
|
|
this.stopAnimation(a0);
|
|
this._value = this._startingValue;
|
|
if (this.__isNative) {
|
|
Module357.API.setAnimatedNodeValue(this.__getNativeTag(), this._startingValue);
|
|
}
|
|
}
|
|
}, {
|
|
key: "__onAnimatedValueUpdateReceived",
|
|
value: function __onAnimatedValueUpdateReceived(a0, a1) {
|
|
this._updateValue(a0, false);
|
|
if (a1 != null) {
|
|
this._offset = a1;
|
|
}
|
|
}
|
|
}, {
|
|
key: "interpolate",
|
|
value: function interpolate(a0) {
|
|
return new mapStringToNumericComponents(this, a0);
|
|
}
|
|
}, {
|
|
key: "animate",
|
|
value: function animate(a0, c23696_0) {
|
|
const _animation = this._animation;
|
|
if (this._animation) {
|
|
this._animation.stop();
|
|
}
|
|
this._animation = a0;
|
|
a0.start(this._value, (a0) => {
|
|
this._updateValue(a0, true);
|
|
}, (a0) => {
|
|
this._animation = null;
|
|
if (c23696_0) {
|
|
c23696_0(a0);
|
|
}
|
|
}, _animation, this);
|
|
}
|
|
}, {
|
|
key: "stopTracking",
|
|
value: function stopTracking() {
|
|
if (this._tracking) {
|
|
this._tracking.__detach();
|
|
}
|
|
this._tracking = null;
|
|
}
|
|
}, {
|
|
key: "track",
|
|
value: function track(a0) {
|
|
this.stopTracking();
|
|
this._tracking = a0;
|
|
if (this._tracking) {
|
|
this._tracking.update();
|
|
}
|
|
}
|
|
}, {
|
|
key: "_updateValue",
|
|
value: function _updateValue(a0, a1) {
|
|
if (a0 === void 0) {
|
|
throw new Error("AnimatedValue: Attempting to set value to undefined");
|
|
}
|
|
this._value = a0;
|
|
if (a1) {
|
|
let env23697;
|
|
const r8 = env23697 = {};
|
|
const set = new Set();
|
|
env23697[0] = set;
|
|
const r5 = $mk66226(r8);
|
|
env23697[1] = r5;
|
|
if (typeof this.update === "function") {
|
|
set.add(this);
|
|
} else {
|
|
this.__getChildren().forEach(r5);
|
|
}
|
|
set.forEach($mk66227());
|
|
}
|
|
this.__callListeners(this.__getValue());
|
|
}
|
|
}, {
|
|
key: "__getNativeConfig",
|
|
value: function __getNativeConfig() {
|
|
return {
|
|
type: "value",
|
|
value: this._value,
|
|
offset: this._offset,
|
|
debugID: this.__getDebugID()
|
|
};
|
|
}
|
|
}]);
|
|
export function flushValue(a0) {
|
|
let env12273;
|
|
const r1 = env12273 = {};
|
|
const set = new Set();
|
|
env12273[0] = set;
|
|
const r5 = $mk66226(r1);
|
|
env12273[1] = r5;
|
|
if (typeof a0.update === "function") {
|
|
set.add(a0);
|
|
} else {
|
|
a0.__getChildren().forEach(r5);
|
|
}
|
|
set.forEach($mk66227());
|
|
}
|