-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add report card lost or damaged #28141
Merged
marcaaron
merged 72 commits into
Expensify:main
from
JKobrynski:addReportCardLostOrDamaged
Oct 18, 2023
Merged
Changes from all commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
b086a78
create ReportCardLostPage, add it to navigator
JKobrynski c05c66a
add form to onyxkeys
JKobrynski 74a9ee4
start working on SingleOptionSelector
JKobrynski a7c7967
improve SingleOptionSelector style
JKobrynski 4eb4110
add translations
JKobrynski 2667b60
translate SingleOptionSelectors options
JKobrynski e028b03
add missing translations
JKobrynski 08ec6c2
add missing components to ReportCardLostPage
JKobrynski 8924ee2
reorganize styles in ReportCardLostPage
JKobrynski 3b2258f
add missing translations
JKobrynski ed38f87
fetch personal details in ReportCardLostPage
JKobrynski 1cbee35
add button style prop to forms
JKobrynski 4b061e2
improve button style
JKobrynski fc32988
add comments
JKobrynski a3df9af
update translations
JKobrynski c41a995
add spanish translations
JKobrynski 28fe506
adjust forms to use the latest props
JKobrynski f7d33df
add new form to ONYXKEYS
JKobrynski d93c5c9
start implementing card settings api methods
JKobrynski 081f345
add validation logic to report form
JKobrynski 1085775
feat: pass tag list name to the modified expense message
BeeMargarida 3be55da
fix: small review fixes
BeeMargarida 66929c1
revert Accessibility change
JKobrynski f3a1a06
revert Accessibility.md changes
JKobrynski 96bc338
revert Form.js changes
JKobrynski 230d896
remove deprecated english translations
JKobrynski 2ecedc0
add missing prop to dependency array
JKobrynski 81c8e27
remove unused spanish translations
JKobrynski aca1aed
Update CardSettings action
JKobrynski a8d3767
add missing translations
JKobrynski 012522f
modify route definition
JKobrynski 68f2b5b
rename card actions file
JKobrynski cd98566
rename onyx form key
JKobrynski 13b479e
allow reporting card loss from the card page
JKobrynski 35257fc
add translations for error message
JKobrynski 4508c0d
finish implementing report flow
JKobrynski 7aef737
remove buttonStyles prop from Form
JKobrynski 60662c5
rename onyx key
JKobrynski 6dae971
filter empty address values
JKobrynski 6813070
make early return as early as possible
JKobrynski 874a184
modify constant value
JKobrynski 0f869cd
remove redundant translation
JKobrynski 0798bad
use correct form key
JKobrynski a31a261
create findPhysicalCard helper funciton
JKobrynski da07741
split onSubmit into two functions
JKobrynski dd9e502
remove unused funciton
JKobrynski 3fccb6f
split use effect into two simpler ones
JKobrynski 1fe6321
move getFormattedAddress method to PersonalDetailsUtils
JKobrynski 7da72a3
add early returns to effects
JKobrynski 3fbd5ef
minor code changes, improvements
JKobrynski f7600fb
remove left margin from singleOptionSelector
JKobrynski fa2169e
remove preselected reason, add reason error
JKobrynski 99c544f
shrink pressable area in SingleOptionSelector
JKobrynski d1f86ff
allow going back to the previous step
JKobrynski f6a4b3c
use FormAlertWithSubmitButton instead of Form
JKobrynski 2943483
Merge branch 'main' into addReportCardLostOrDamaged
JKobrynski 0087486
remove unnecessary comment
JKobrynski 2ad20cf
add extra padding on top
JKobrynski 6c7d9ab
use MenuItem instead of MenuItemWithTopDescription
JKobrynski 1c97d2b
Merge branch 'main' into addReportCardLostOrDamaged
JKobrynski 6ffaca7
support multiline title
JKobrynski 9dc0dc7
Merge branch 'main' into addReportCardLostOrDamaged
JKobrynski 3569cbd
fix linting
JKobrynski 37d95d0
Merge branch 'main' into addReportCardLostOrDamaged
JKobrynski abeaab6
change forms onyx key
JKobrynski bacb751
Merge branch 'main' into addReportCardLostOrDamaged
JKobrynski fb9c10b
Merge branch 'main' into addReportCardLostOrDamaged
JKobrynski c448920
modify route name to singular
JKobrynski 80f1e99
spread styles array
JKobrynski d13063d
Merge branch 'main' into addReportCardLostOrDamaged
JKobrynski 65ce035
Merge branch 'main' into addReportCardLostOrDamaged
JKobrynski a1c8c74
change SelectCircle border color
JKobrynski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,67 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import _ from 'underscore'; | ||
import {View} from 'react-native'; | ||
import SelectCircle from './SelectCircle'; | ||
import styles from '../styles/styles'; | ||
import CONST from '../CONST'; | ||
import Text from './Text'; | ||
import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback'; | ||
import withLocalize, {withLocalizePropTypes} from './withLocalize'; | ||
|
||
const propTypes = { | ||
/** Array of options for the selector, key is a unique identifier, label is a localize key that will be translated and displayed */ | ||
options: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
key: PropTypes.string, | ||
label: PropTypes.string, | ||
}), | ||
), | ||
|
||
/** Key of the option that is currently selected */ | ||
selectedOptionKey: PropTypes.string, | ||
|
||
/** Function to be called when an option is selected */ | ||
onSelectOption: PropTypes.func, | ||
...withLocalizePropTypes, | ||
}; | ||
|
||
const defaultProps = { | ||
options: [], | ||
selectedOptionKey: undefined, | ||
onSelectOption: () => {}, | ||
}; | ||
|
||
function SingleOptionSelector({options, selectedOptionKey, onSelectOption, translate}) { | ||
return ( | ||
<View style={styles.pt4}> | ||
{_.map(options, (option) => ( | ||
<View | ||
style={styles.flexRow} | ||
key={option.key} | ||
> | ||
<PressableWithoutFeedback | ||
style={styles.singleOptionSelectorRow} | ||
onPress={() => onSelectOption(option)} | ||
accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON} | ||
accessibilityState={{checked: selectedOptionKey === option.key}} | ||
aria-checked={selectedOptionKey === option.key} | ||
accessibilityLabel={option.label} | ||
> | ||
<SelectCircle | ||
isChecked={selectedOptionKey ? selectedOptionKey === option.key : false} | ||
styles={[styles.ml0, styles.singleOptionSelectorCircle]} | ||
/> | ||
<Text>{translate(option.label)}</Text> | ||
</PressableWithoutFeedback> | ||
</View> | ||
))} | ||
</View> | ||
); | ||
} | ||
|
||
SingleOptionSelector.propTypes = propTypes; | ||
SingleOptionSelector.defaultProps = defaultProps; | ||
SingleOptionSelector.displayName = 'SingleOptionSelector'; | ||
|
||
export default withLocalize(SingleOptionSelector); | ||
JKobrynski marked this conversation as resolved.
Show resolved
Hide resolved
|
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
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the
useLocalize
hook instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately it's not possible, it causes an error (discussed in this comment). It's probably caused by
Form
that useswithLocalize
and wrapsSingleOptionSelector
in that case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can address this in a follow up and this is not a blocker for now.