Skip to content
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

Fix/37095: Tag list show required #37388

Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ function MoneyTemporaryForRefactorRequestConfirmationList({

const policyTagLists = useMemo(() => PolicyUtils.getTagLists(policyTags), [policyTags]);

// Check if it is the multiple levels tags or not
const isMultipleLevelsTags = policyTagLists && policyTagLists.length > 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to return required field in case of single tag. Because with the current solution, in case of multiple tags but just have one tag list, isMultipleLevelsTags is false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as this one #35134 (comment)


// A flag for showing the tags field
const shouldShowTags = useMemo(() => isPolicyExpenseChat && OptionsListUtils.hasEnabledTags(policyTagLists), [isPolicyExpenseChat, policyTagLists]);

Expand Down Expand Up @@ -762,7 +765,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
shouldShow: shouldShowCategories,
isSupplementary: !isCategoryRequired,
},
..._.map(policyTagLists, ({name}, index) => ({
..._.map(policyTagLists, ({name, required}, index) => ({
item: (
<MenuItemWithTopDescription
key={name}
Expand All @@ -778,7 +781,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
style={[styles.moneyRequestMenuItem]}
disabled={didConfirm}
interactive={!isReadOnly}
rightLabel={isTagRequired ? translate('common.required') : ''}
rightLabel={(isMultipleLevelsTags ? required : isTagRequired) ? translate('common.required') : ''}
/>
),
shouldShow: shouldShowTags,
Expand Down
Loading