Add Illness Question #11
Merged
anthony.richard
merged 1 commits from Add_Illness_Question
into Quiz_Behind
4 months ago
After Width: | Height: | Size: 39 KiB |
@ -0,0 +1,54 @@
|
|||||||
|
import React, { useState } from "react";
|
||||||
|
import Question, { QuestionChildProps } from "./Question";
|
||||||
|
import { Image, View, Text } from "react-native";
|
||||||
|
import { MultiSelect } from "react-native-element-dropdown";
|
||||||
|
|
||||||
|
//@ts-ignore
|
||||||
|
import WheelChair from "@/assets/images/wheelchair.png";
|
||||||
|
import { EHealthProblem } from "@/model/enums/Enums";
|
||||||
|
|
||||||
|
export default React.forwardRef<any, QuestionChildProps>(
|
||||||
|
({ ...props }, ref) => {
|
||||||
|
const [selected, setSelected] = useState<string[]>([]);
|
||||||
|
|
||||||
|
type DataItem = {
|
||||||
|
label: string;
|
||||||
|
value: EHealthProblem;
|
||||||
|
};
|
||||||
|
|
||||||
|
const data: DataItem[] = [
|
||||||
|
{ label: "Arthrose", value: "ARTHROSE" },
|
||||||
|
{ label: "Migraine", value: "MIGRAINE" },
|
||||||
|
];
|
||||||
|
|
||||||
|
const renderItem = (item: { label: string }) => {
|
||||||
|
return (
|
||||||
|
<View className="p-4">
|
||||||
|
<Text>{item.label}</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Question
|
||||||
|
question="Avez-vous des problèmes physiques ?"
|
||||||
|
{...props}
|
||||||
|
{...ref}
|
||||||
|
>
|
||||||
|
<Image className="self-center" source={WheelChair} alt="" />
|
||||||
|
<View className="border-2 border-orange-500 rounded-3xl p-4">
|
||||||
|
<MultiSelect
|
||||||
|
data={data}
|
||||||
|
labelField="label"
|
||||||
|
valueField="value"
|
||||||
|
placeholder="Selectionnez un problème physique "
|
||||||
|
searchPlaceholder="Search..."
|
||||||
|
value={selected}
|
||||||
|
onChange={setSelected}
|
||||||
|
renderItem={renderItem}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</Question>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
Loading…
Reference in new issue