"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useErrorShakeAnimation = void 0;
var _reactNativeReanimated = require("react-native-reanimated");
var _react = require("react");
var _functions = require("../../functions");
const SHAKE_OFFSET = 8;
const useErrorShakeAnimation = () => {
  const translate = (0, _reactNativeReanimated.useSharedValue)(0);
  const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
    transform: [{
      translateX: translate.value
    }]
  }));
  const shakeAnimation = (0, _react.useCallback)(() => {
    (0, _functions.triggerHaptic)("notificationError");
    return (0, _reactNativeReanimated.withSequence)((0, _reactNativeReanimated.withTiming)(SHAKE_OFFSET, {
      duration: 75,
      easing: _reactNativeReanimated.Easing.inOut(_reactNativeReanimated.Easing.cubic)
    }), (0, _reactNativeReanimated.withTiming)(-SHAKE_OFFSET, {
      duration: 75,
      easing: _reactNativeReanimated.Easing.inOut(_reactNativeReanimated.Easing.cubic)
    }), (0, _reactNativeReanimated.withTiming)(SHAKE_OFFSET / 2, {
      duration: 75,
      easing: _reactNativeReanimated.Easing.inOut(_reactNativeReanimated.Easing.cubic)
    }), (0, _reactNativeReanimated.withTiming)(-SHAKE_OFFSET / 2, {
      duration: 75,
      easing: _reactNativeReanimated.Easing.inOut(_reactNativeReanimated.Easing.cubic)
    }), (0, _reactNativeReanimated.withTiming)(0, {
      duration: 75,
      easing: _reactNativeReanimated.Easing.inOut(_reactNativeReanimated.Easing.cubic)
    }));
  }, []);
  return {
    translate,
    animatedStyle,
    shakeAnimation
  };
};
exports.useErrorShakeAnimation = useErrorShakeAnimation;
//# sourceMappingURL=useErrorShakeAnimation.js.map