import { Text } from "react-native";
import { Switch } from "react-native-elements";
import { AS } from "../../../storageControl";
export const SwitchBox = (props) => {
  const { value, setValue, setKey, title } = props;
  const textStyle = {
    alignItems: "center",
    alignContent: "center",
    textAlign: "center",
    textAlignVertical: "center",
    color: "white",
  };
  return (
    <>
      <Text style={textStyle}>{title}</Text>
      <Switch
        value={value}
        onValueChange={(v) => {
          AS.setItem(setKey, v.toString());
          setValue(v);
        }}
      />
    </>
  );
};
