function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React from "react";
import { Animated, StyleSheet, View } from "react-native";
import Indicator from "./indicator";
/** A component used to provide a visual cue that an action is either processing, awaiting a course of change or a result. */
const PulseIndicator = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(({
  size = 30,
  color = "rgb(0, 0, 0)",
  ...rest
}, ref) => {
  const _renderComponent = React.useCallback(({
    index,
    count,
    progress
  }) => {
    let pulseStyle = {
      height: size,
      width: size,
      borderRadius: size / 2,
      backgroundColor: color,
      transform: [{
        scale: progress.interpolate({
          inputRange: [0, 0.67, 1],
          outputRange: index ? [0.4, 0.6, 0.4] : [0.4, 0.6, 1.0]
        })
      }],
      opacity: progress.interpolate({
        inputRange: [0, 0.67, 1],
        outputRange: index ? [1.0, 1.0, 1.0] : [0.5, 0.5, 0.0]
      })
    };
    return /*#__PURE__*/React.createElement(Animated.View, {
      style: {
        ...StyleSheet.absoluteFillObject,
        justifyContent: "center",
        alignItems: "center"
      },
      key: index
    }, /*#__PURE__*/React.createElement(Animated.View, {
      style: pulseStyle
    }));
  }, [size, color]);
  const {
    style,
    ...props
  } = rest;
  return /*#__PURE__*/React.createElement(View, {
    style: [{
      flex: 1,
      justifyContent: "center",
      alignItems: "center"
    }, style]
  }, /*#__PURE__*/React.createElement(Indicator, _extends({}, props, {
    ref: ref,
    style: {
      width: size,
      height: size
    },
    renderComponent: _renderComponent,
    count: 2
  })));
}));
export default PulseIndicator;
//# sourceMappingURL=pulse.js.map