"use strict";

import { useContext } from 'react';
import { TouchableOpacity, View } from 'react-native';
import { ApplicationContext } from "../Context/index.js";
import { Colors } from "../Consts/index.js";
import styles from "./styles.js";
import { jsx as _jsx } from "react/jsx-runtime";
const Switch = ({
  value = false,
  onChange,
  disabled = false,
  style
}) => {
  const {
    theme
  } = useContext(ApplicationContext);
  const circleBackgroundColor = value ? Colors.white : Colors.black_17;
  const circleAlign = value ? 'flex-end' : 'flex-start';
  let backgroundColor = value ? theme.colors.primary.default : theme.colors.text.secondary;
  if (disabled) {
    backgroundColor = value ? theme.colors.primary.light : theme.colors.background.disable;
  }
  return /*#__PURE__*/_jsx(TouchableOpacity, {
    disabled: disabled,
    onPress: () => {
      onChange?.(!value);
    },
    style: [style, styles.container, {
      backgroundColor,
      alignItems: circleAlign
    }],
    children: /*#__PURE__*/_jsx(View, {
      style: [styles.circle, {
        backgroundColor: circleBackgroundColor
      }],
      children: /*#__PURE__*/_jsx(View, {
        style: [styles.circleSmall, {
          backgroundColor
        }]
      })
    })
  });
};
export { Switch };
//# sourceMappingURL=index.js.map