Extract PickList wrapper from elements index
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import React from "react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { Field } from "redux-form";
|
||||
import { RenderPickList } from "./renderPickList";
|
||||
|
||||
export function PickList(props) {
|
||||
const { datafieldname } = props;
|
||||
let { t } = useTranslation();
|
||||
|
||||
const required = (value) => {
|
||||
return value || value == 0
|
||||
? undefined
|
||||
: t("newappeal:is-required-label");
|
||||
};
|
||||
|
||||
return (
|
||||
<Field
|
||||
name={props.name}
|
||||
id={props.name}
|
||||
label={props.label}
|
||||
component={RenderPickList}
|
||||
datafieldname={datafieldname}
|
||||
picklistData={props.picklistData}
|
||||
hint={props.hint}
|
||||
errorMsg={t("newappeal:is-required-label")}
|
||||
validate={[required]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user