-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathTextInput.tsx
More file actions
32 lines (30 loc) · 788 Bytes
/
TextInput.tsx
File metadata and controls
32 lines (30 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React, { forwardRef } from "react";
import Input from "antd/es/input/Input";
import FormItem from "antd/es/form/FormItem";
export default forwardRef((props: any, ref: any) => {
const { form, inputData, language } = props,
{ required, questions, id, defaultValue } = inputData,
{ getFieldDecorator } = form;
return (
<FormItem
colon={false}
label={
<label
dangerouslySetInnerHTML={{
__html: questions[language] || "no question for selected language"
}}
/>
}
>
{getFieldDecorator(id, {
initialValue: defaultValue,
rules: [
{
required,
message: "Required Field"
}
]
})(<Input ref={ref} />)}
</FormItem>
);
});