create-expo-cljs-app
Version:
Create a react native application with Expo and Shadow-CLJS!
63 lines (51 loc) • 2.1 kB
JavaScript
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
*/
;
import NativeAnimatedHelper from '../NativeAnimatedHelper';
var startNativeAnimationNextId = 1; // Important note: start() and stop() will only be called at most once.
// Once an animation has been stopped or finished its course, it will
// not be reused.
var Animation = /*#__PURE__*/function () {
function Animation() {}
var _proto = Animation.prototype;
_proto.start = function start(fromValue, onUpdate, onEnd, previousAnimation, animatedValue) {};
_proto.stop = function stop() {
if (this.__nativeId) {
NativeAnimatedHelper.API.stopAnimation(this.__nativeId);
}
};
_proto.__getNativeAnimationConfig = function __getNativeAnimationConfig() {
// Subclasses that have corresponding animation implementation done in native
// should override this method
throw new Error('This animation type cannot be offloaded to native');
} // Helper function for subclasses to make sure onEnd is only called once.
;
_proto.__debouncedOnEnd = function __debouncedOnEnd(result) {
var onEnd = this.__onEnd;
this.__onEnd = null;
onEnd && onEnd(result);
};
_proto.__startNativeAnimation = function __startNativeAnimation(animatedValue) {
var startNativeAnimationWaitId = startNativeAnimationNextId + ":startAnimation";
startNativeAnimationNextId += 1;
NativeAnimatedHelper.API.setWaitingForIdentifier(startNativeAnimationWaitId);
try {
animatedValue.__makeNative();
this.__nativeId = NativeAnimatedHelper.generateNewAnimationId();
NativeAnimatedHelper.API.startAnimatingNode(this.__nativeId, animatedValue.__getNativeTag(), this.__getNativeAnimationConfig(), this.__debouncedOnEnd.bind(this));
} catch (e) {
throw e;
} finally {
NativeAnimatedHelper.API.unsetWaitingForIdentifier(startNativeAnimationWaitId);
}
};
return Animation;
}();
export default Animation;