Skip to content

Commit efad7b7

Browse files
authored
Merge pull request #61793 from huult/61115-missing-bg-color-expense-preview-loading
2 parents ab29d2a + e387453 commit efad7b7

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
lines changed

src/components/ReceiptEmptyState.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ function ReceiptEmptyState({hasError = false, onPress, disabled = false, isThumb
3535
const theme = useTheme();
3636

3737
const Wrapper = onPress ? PressableWithoutFeedback : View;
38+
const containerStyle = [
39+
styles.alignItemsCenter,
40+
styles.justifyContentCenter,
41+
styles.moneyRequestViewImage,
42+
isThumbnail ? styles.moneyRequestAttachReceiptThumbnail : styles.moneyRequestAttachReceipt,
43+
isThumbnail && !isInMoneyRequestView && styles.w100,
44+
isThumbnail && isInMoneyRequestView && styles.thumbnailImageContainerHighlight,
45+
isInMoneyRequestView && styles.expenseViewImage,
46+
hasError && styles.borderColorDanger,
47+
shouldUseFullHeight && styles.receiptEmptyStateFullHeight,
48+
];
3849

3950
return (
4051
<Wrapper
@@ -43,16 +54,7 @@ function ReceiptEmptyState({hasError = false, onPress, disabled = false, isThumb
4354
onPress={onPress}
4455
disabled={disabled}
4556
disabledStyle={styles.cursorDefault}
46-
style={[
47-
styles.alignItemsCenter,
48-
styles.justifyContentCenter,
49-
styles.moneyRequestViewImage,
50-
isThumbnail ? styles.moneyRequestAttachReceiptThumbnail : styles.moneyRequestAttachReceipt,
51-
isThumbnail && !isInMoneyRequestView && styles.w100,
52-
isInMoneyRequestView && styles.expenseViewImage,
53-
hasError && styles.borderColorDanger,
54-
shouldUseFullHeight && styles.receiptEmptyStateFullHeight,
55-
]}
57+
style={containerStyle}
5658
>
5759
<View>
5860
<Icon

src/components/ReceiptImage.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ type ReceiptImageProps = (
8080
/** The style of the loading indicator */
8181
loadingIndicatorStyles?: StyleProp<ViewStyle>;
8282

83+
/** Styles applied to the thumbnail container */
84+
thumbnailContainerStyles?: StyleProp<ViewStyle>;
85+
8386
/** If the image fails to load – show the provided fallback icon */
8487
fallbackIcon?: IconAsset;
8588

@@ -130,6 +133,7 @@ function ReceiptImage({
130133
isPerDiemRequest,
131134
shouldUseFullHeight,
132135
loadingIndicatorStyles,
136+
thumbnailContainerStyles,
133137
}: ReceiptImageProps) {
134138
const styles = useThemeStyles();
135139

@@ -180,7 +184,7 @@ function ReceiptImage({
180184
return (
181185
<ThumbnailImage
182186
previewSourceURL={source ?? ''}
183-
style={[styles.w100, styles.h100]}
187+
style={[styles.w100, styles.h100, thumbnailContainerStyles]}
184188
isAuthTokenRequired={isAuthTokenRequired ?? false}
185189
shouldDynamicallyResize={false}
186190
fallbackIcon={fallbackIcon}

src/components/ReportActionItem/ReportActionItemImage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ function ReportActionItemImage({
171171
<ReceiptImage
172172
{...propsObj}
173173
shouldUseFullHeight={shouldUseFullHeight}
174+
thumbnailContainerStyles={styles.thumbnailImageContainerHover}
174175
/>
175176
);
176177
}

src/components/ThumbnailImage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function ThumbnailImage({
145145
}
146146

147147
return (
148-
<View style={[style, styles.overflowHidden]}>
148+
<View style={[styles.thumbnailImageContainerHighlight, style, styles.overflowHidden]}>
149149
{!!isDeleted && <AttachmentDeletedIndicator containerStyles={[...sizeStyles]} />}
150150
<View style={[...sizeStyles, styles.alignItemsCenter, styles.justifyContentCenter]}>
151151
<ImageWithSizeCalculation

src/styles/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5779,6 +5779,14 @@ const styles = (theme: ThemeColors) =>
57795779
// Choosing a lowest value just above the threshold for the items to adjust width against the various screens. Only 2 items are shown 35 * 2 = 70 thus third item of 35% width can't fit forcing a two column layout.
57805780
flexBasis: '35%',
57815781
},
5782+
5783+
thumbnailImageContainerHover: {
5784+
backgroundColor: theme.hoverComponentBG,
5785+
},
5786+
5787+
thumbnailImageContainerHighlight: {
5788+
backgroundColor: theme.highlightBG,
5789+
},
57825790
} satisfies Styles);
57835791

57845792
type ThemeStyles = ReturnType<typeof styles>;

0 commit comments

Comments
 (0)