import { View, Textarea } from "@tarojs/components";

interface FormTextareaProps {
  placeholder?: string;
  value?: string;
  onChange?: (value: string) => void;
}

const FormTextarea = (props: FormTextareaProps) => {
  const { placeholder, value, onChange } = props;
  return (
    <View style={{ width: "100%" }}>
      <Textarea
        autoHeight
        style={{ width: "100%" }}
        value={value}
        placeholder={placeholder ?? "请输入"}
        onInput={(e) => {
          const value = e.detail.value;

          if (onChange) {
            onChange(value);
          }
        }}
      />
    </View>
  );
};

export default FormTextarea;
