import { View, Text } from "react-native";
import React, { useState } from "react";
import RadioButton from "./RadioButton";
import { GroupProps } from "./RadioButton.types";

import { styles } from "./Radio.style";
const RadioGroup = ({
  mainView,
  options,
  onSelect,
  width,
  height,
  isFullWidth,
  ballHeight,
  ballColor,
  radioborder,
  ballWidth,
  borderWidth,
  selected,
}: GroupProps) => {
  const onRadioButtonPress = (item: string | number) => {
    onSelect(item);
  };
  return (
    <View style={[styles.mainView, mainView]}>
      {options.map((item, index) => (
        <RadioButton
          key={index}
          label={item}
          onPress={() => onRadioButtonPress(item)}
          selected={selected}
          width={width}
          height={height}
          ballHeight={ballHeight}
          ballColor={ballColor}
          radioborder={radioborder}
          ballWidth={ballWidth}
          borderWidth={borderWidth}
          isFullWidth={isFullWidth}
        />
      ))}
    </View>
  );
};

export default RadioGroup;
