-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 #51648 from callstack-internal/feat/50901-GR-step-…
…5-director-information-screen [GR Phase 2] Step 5 Director information screen (without API calls) - implementation
- Loading branch information
Showing
29 changed files
with
1,207 additions
and
145 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
assets/images/simple-illustrations/simple-illustration__pillow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,73 @@ | ||
import React, {useMemo, useState} from 'react'; | ||
import type {StyleProp, ViewStyle} from 'react-native'; | ||
import FormProvider from '@components/Form/FormProvider'; | ||
import type {Choice} from '@components/RadioButtons'; | ||
import RadioButtons from '@components/RadioButtons'; | ||
import Text from '@components/Text'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
|
||
type YesNoStepProps = { | ||
/** The title of the question */ | ||
title: string; | ||
|
||
/** The description of the question */ | ||
description: string; | ||
|
||
/** The default value of the radio button */ | ||
defaultValue: boolean; | ||
|
||
/** Callback when the value is selected */ | ||
onSelectedValue: (value: boolean) => void; | ||
|
||
/** The style of the submit button */ | ||
submitButtonStyles?: StyleProp<ViewStyle>; | ||
}; | ||
|
||
function YesNoStep({title, description, defaultValue, onSelectedValue, submitButtonStyles}: YesNoStepProps) { | ||
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
const [value, setValue] = useState(defaultValue); | ||
|
||
const handleSubmit = () => { | ||
onSelectedValue(value); | ||
}; | ||
const handleSelectValue = (newValue: string) => setValue(newValue === 'true'); | ||
const options = useMemo<Choice[]>( | ||
() => [ | ||
{ | ||
label: translate('common.yes'), | ||
value: 'true', | ||
}, | ||
{ | ||
label: translate('common.no'), | ||
value: 'false', | ||
}, | ||
], | ||
[translate], | ||
); | ||
|
||
return ( | ||
<FormProvider | ||
formID={ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM} | ||
submitButtonText={translate('common.confirm')} | ||
onSubmit={handleSubmit} | ||
style={[styles.mh5, styles.flexGrow1]} | ||
submitButtonStyles={submitButtonStyles} | ||
> | ||
<Text style={[styles.textHeadlineLineHeightXXL]}>{title}</Text> | ||
<Text style={[styles.pv3, styles.textSupporting]}>{description}</Text> | ||
<RadioButtons | ||
items={options} | ||
onPress={handleSelectValue} | ||
defaultCheckedValue={defaultValue.toString()} | ||
radioButtonStyle={[styles.mb6]} | ||
/> | ||
</FormProvider> | ||
); | ||
} | ||
|
||
YesNoStep.displayName = 'YesNoStep'; | ||
|
||
export default YesNoStep; |
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
Oops, something went wrong.