11import React , { useCallback , useMemo } from 'react' ;
22import { View } from 'react-native' ;
33import Checkbox from '@components/Checkbox' ;
4+ import OfflineWithFeedback from '@components/OfflineWithFeedback' ;
45import Text from '@components/Text' ;
56import useLocalize from '@hooks/useLocalize' ;
67import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
@@ -10,6 +11,7 @@ import {getCommaSeparatedTagNameWithSanitizedColons} from '@libs/PolicyUtils';
1011import variables from '@styles/variables' ;
1112import CONST from '@src/CONST' ;
1213import type { GroupedTransactions } from '@src/types/onyx' ;
14+ import type { PendingAction } from '@src/types/onyx/OnyxCommon' ;
1315
1416// Height constants
1517const DESKTOP_HEIGHT = 28 ;
@@ -43,6 +45,9 @@ type MoneyRequestReportGroupHeaderProps = {
4345
4446 /** Callback when group checkbox is toggled - receives groupKey */
4547 onToggleSelection ?: ( groupKey : string ) => void ;
48+
49+ /** Pending action for offline feedback styling (Pattern B - Optimistic WITH Feedback) */
50+ pendingAction ?: PendingAction ;
4651} ;
4752
4853function MoneyRequestReportGroupHeader ( {
@@ -55,6 +60,7 @@ function MoneyRequestReportGroupHeader({
5560 isIndeterminate = false ,
5661 isDisabled = false ,
5762 onToggleSelection,
63+ pendingAction,
5864} : MoneyRequestReportGroupHeaderProps ) {
5965 const styles = useThemeStyles ( ) ;
6066 const { translate} = useLocalize ( ) ;
@@ -84,28 +90,30 @@ function MoneyRequestReportGroupHeader({
8490 } , [ onToggleSelection , groupKey ] ) ;
8591
8692 return (
87- < View style = { [ styles . reportLayoutGroupHeader , conditionalHeight ] } >
88- < View style = { [ styles . flexRow , styles . alignItemsCenter , styles . flex1 ] } >
89- { shouldShowCheckbox && (
90- < Checkbox
91- isChecked = { isSelected }
92- isIndeterminate = { isIndeterminate }
93- disabled = { isDisabled }
94- onPress = { handleToggleSelection }
95- accessibilityLabel = { translate ( 'reportLayout.selectGroup' , { groupName : displayName } ) }
96- style = { styles . mr2 }
97- />
98- ) }
99- < Text
100- style = { [ styles . textBold , textStyle , styles . flexShrink1 , shouldShowCheckbox && styles . ml2 ] }
101- numberOfLines = { 1 }
102- >
103- { displayName }
104- </ Text >
105- < Text style = { [ styles . textBold , textStyle , styles . mh1 ] } > { CONST . DOT_SEPARATOR } </ Text >
106- < Text style = { [ styles . textBold , textStyle ] } > { formattedAmount } </ Text >
93+ < OfflineWithFeedback pendingAction = { pendingAction } >
94+ < View style = { [ styles . reportLayoutGroupHeader , conditionalHeight ] } >
95+ < View style = { [ styles . flexRow , styles . alignItemsCenter , styles . flex1 ] } >
96+ { shouldShowCheckbox && (
97+ < Checkbox
98+ isChecked = { isSelected }
99+ isIndeterminate = { isIndeterminate }
100+ disabled = { isDisabled }
101+ onPress = { handleToggleSelection }
102+ accessibilityLabel = { translate ( 'reportLayout.selectGroup' , { groupName : displayName } ) }
103+ style = { styles . mr2 }
104+ />
105+ ) }
106+ < Text
107+ style = { [ styles . textBold , textStyle , styles . flexShrink1 , shouldShowCheckbox && styles . ml2 ] }
108+ numberOfLines = { 1 }
109+ >
110+ { displayName }
111+ </ Text >
112+ < Text style = { [ styles . textBold , textStyle , styles . mh1 ] } > { CONST . DOT_SEPARATOR } </ Text >
113+ < Text style = { [ styles . textBold , textStyle ] } > { formattedAmount } </ Text >
114+ </ View >
107115 </ View >
108- </ View >
116+ </ OfflineWithFeedback >
109117 ) ;
110118}
111119
0 commit comments