"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useListItemAnimation = void 0;
var _reactNativeReanimated = require("react-native-reanimated");
var _context = require("../context");
var _core = require("../core");
var _hooks = require("../utils/hooks");
const useListItemAnimation = () => {
  const {
    progress,
    onPressIn,
    onPressOut
  } = (0, _hooks.useSpringPressProgressValue)("button");
  const theme = (0, _context.useIOTheme)();
  const mapBackgroundStates = {
    default: (0, _core.hexToRgba)(_core.IOColors[theme["listItem-pressed"]], 0),
    pressed: _core.IOColors[theme["listItem-pressed"]]
  };

  // Interpolate animation values from `isPressed` values
  const scaleAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
    transform: [{
      scale: (0, _reactNativeReanimated.interpolate)(progress.value, [0, 1], [1, _core.IOScaleEffect.slight], _reactNativeReanimated.Extrapolation.CLAMP)
    }]
  }));
  const backgroundAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
    backgroundColor: (0, _reactNativeReanimated.interpolateColor)(progress.value, [0, 1], [mapBackgroundStates.default, mapBackgroundStates.pressed])
  }));
  return {
    progress,
    onPressIn,
    onPressOut,
    scaleAnimatedStyle,
    backgroundAnimatedStyle
  };
};
exports.useListItemAnimation = useListItemAnimation;
//# sourceMappingURL=useListItemAnimation.js.map