You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Mobile/components/quiz/AgeQuestion.tsx

41 lines
1.1 KiB

import React from "react";
import Question, { QuestionChildProps } from "./Question";
import Slider from "../ui/Slider";
import { View } from "react-native";
import Text from "../ui/Text";
export default React.forwardRef<any, QuestionChildProps>(
(props, ref): React.ReactElement => {
const MIN_AGE = 18;
const MAX_AGE = 100;
const [age, setAge] = React.useState(MIN_AGE);
return (
<Question question="Quel âge avez-vous ?" {...ref} {...props}>
<View className="flex-row justify-center">
{age <= MIN_AGE ? (
<Text className="mt-8" size="4xl">
- de
</Text>
) : null}
{age >= MAX_AGE ? (
<Text className="mt-8" size="4xl">
+ de
</Text>
) : null}
<Text size="8xl" weight="bold">
{age}
</Text>
<Text className="mt-8" size="4xl">
ans
</Text>
</View>
<Slider
minimumValue={MIN_AGE}
maximumValue={MAX_AGE}
onValueChange={setAge}
/>
</Question>
);
}
);