@@ -9,6 +9,7 @@ import ScreenWrapper from '@components/ScreenWrapper';
99import ScrollView from '@components/ScrollView' ;
1010import useLocalize from '@hooks/useLocalize' ;
1111import useOnyx from '@hooks/useOnyx' ;
12+ import usePrevious from '@hooks/usePrevious' ;
1213import useThemeStyles from '@hooks/useThemeStyles' ;
1314import { removeSplitExpenseField , updateSplitExpenseField } from '@libs/actions/IOU' ;
1415import { convertToDisplayString } from '@libs/CurrencyUtils' ;
@@ -59,6 +60,8 @@ function SplitExpenseEditPage({route}: SplitExpensePageProps) {
5960 const transactionTag = getTag ( splitExpenseDraftTransaction ) ;
6061 const policyTagLists = useMemo ( ( ) => getTagLists ( policyTags ) , [ policyTags ] ) ;
6162
63+ const isCategoryRequired = ! ! policy ?. requiresCategory ;
64+
6265 const shouldShowTags = ! ! policy ?. areTagsEnabled && ! ! ( transactionTag || hasEnabledTags ( policyTagLists ) ) ;
6366 const tagVisibility = useMemo (
6467 ( ) =>
@@ -71,6 +74,8 @@ function SplitExpenseEditPage({route}: SplitExpensePageProps) {
7174 [ shouldShowTags , policy , policyTags , splitExpenseDraftTransaction ] ,
7275 ) ;
7376
77+ const previousTagsVisibility = usePrevious ( tagVisibility . map ( ( v ) => v . shouldShow ) ) ?? [ ] ;
78+
7479 return (
7580 < ScreenWrapper testID = { SplitExpenseEditPage . displayName } >
7681 < FullPageNotFoundView shouldShow = { ! reportID || isEmptyObject ( splitExpenseDraftTransaction ) } >
@@ -111,6 +116,7 @@ function SplitExpenseEditPage({route}: SplitExpensePageProps) {
111116 description = { translate ( 'common.category' ) }
112117 title = { splitExpenseDraftTransactionDetails ?. category }
113118 numberOfLinesTitle = { 2 }
119+ rightLabel = { isCategoryRequired ? translate ( 'common.required' ) : '' }
114120 onPress = { ( ) => {
115121 Navigation . navigate (
116122 ROUTES . MONEY_REQUEST_STEP_CATEGORY . getRoute (
@@ -130,6 +136,8 @@ function SplitExpenseEditPage({route}: SplitExpensePageProps) {
130136 policyTagLists . map ( ( { name} , index ) => {
131137 const tagVisibilityItem = tagVisibility . at ( index ) ;
132138 const shouldShow = tagVisibilityItem ?. shouldShow ?? false ;
139+ const isTagRequired = tagVisibilityItem ?. isTagRequired ?? false ;
140+ const prevShouldShow = previousTagsVisibility . at ( index ) ?? false ;
133141
134142 if ( ! shouldShow ) {
135143 return null ;
@@ -139,11 +147,13 @@ function SplitExpenseEditPage({route}: SplitExpensePageProps) {
139147 < MenuItemWithTopDescription
140148 shouldShowRightIcon
141149 key = { name }
150+ highlighted = { ! getTagForDisplay ( splitExpenseDraftTransaction , index ) && ! prevShouldShow }
142151 title = { getTagForDisplay ( splitExpenseDraftTransaction , index ) }
143152 description = { name }
144153 shouldShowBasicTitle
145154 shouldShowDescriptionOnTop
146155 numberOfLinesTitle = { 2 }
156+ rightLabel = { isTagRequired ? translate ( 'common.required' ) : '' }
147157 onPress = { ( ) => {
148158 Navigation . navigate (
149159 ROUTES . MONEY_REQUEST_STEP_TAG . getRoute (
0 commit comments