forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Expensify#32196 from software-mansion-labs/form-mi…
…gration/idology-questions-fix [Form Provider Refactor] IdologyQuestions fixes
- Loading branch information
Showing
5 changed files
with
96 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React, {ForwardedRef, forwardRef} from 'react'; | ||
import {Text as RNText} from 'react-native'; | ||
import useThemeStyles from '@styles/useThemeStyles'; | ||
import FormHelpMessage from './FormHelpMessage'; | ||
import RadioButtons, {Choice} from './RadioButtons'; | ||
import Text from './Text'; | ||
|
||
type SingleChoiceQuestionProps = { | ||
prompt: string; | ||
errorText?: string | string[]; | ||
possibleAnswers: Choice[]; | ||
currentQuestionIndex: number; | ||
onInputChange: (value: string) => void; | ||
}; | ||
|
||
function SingleChoiceQuestion({prompt, errorText, possibleAnswers, currentQuestionIndex, onInputChange}: SingleChoiceQuestionProps, ref: ForwardedRef<RNText>) { | ||
const styles = useThemeStyles(); | ||
|
||
return ( | ||
<> | ||
<Text | ||
ref={ref} | ||
style={[styles.textStrong, styles.mb5]} | ||
> | ||
{prompt} | ||
</Text> | ||
<RadioButtons | ||
items={possibleAnswers} | ||
key={currentQuestionIndex} | ||
onPress={onInputChange} | ||
/> | ||
<FormHelpMessage message={errorText} /> | ||
</> | ||
); | ||
} | ||
|
||
SingleChoiceQuestion.displayName = 'SingleChoiceQuestion'; | ||
|
||
export default forwardRef(SingleChoiceQuestion); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters