@@ -3,6 +3,7 @@ import type {MoneyRequestReportPreviewStyleType} from '@components/ReportActionI
3
3
import sizing from '@styles/utils/sizing' ;
4
4
// eslint-disable-next-line no-restricted-imports
5
5
import spacing from '@styles/utils/spacing' ;
6
+ import CONST from '@src/CONST' ;
6
7
7
8
const componentsSpacing = {
8
9
flatListStyle : [ spacing . mhn4 ] ,
@@ -11,7 +12,7 @@ const componentsSpacing = {
11
12
} ;
12
13
13
14
const NEXT_TRANSACTION_PEEK = 32 ;
14
- const TRANSACTION_WIDTH_WIDE = 303 ;
15
+ const TRANSACTION_WIDTH_WIDE = CONST . REPORT . TRANSACTION_PREVIEW_WIDTH_WIDE ;
15
16
16
17
const mobileStyle = ( currentWidth : number , isSingleTransaction ?: boolean ) => {
17
18
const peek = isSingleTransaction ? spacing . p4 . padding : NEXT_TRANSACTION_PEEK ;
@@ -23,20 +24,25 @@ const mobileStyle = (currentWidth: number, isSingleTransaction?: boolean) => {
23
24
} ;
24
25
} ;
25
26
26
- const desktopStyle = ( currentWidth : number , isSingleTransaction ?: boolean ) => {
27
+ const desktopStyle = ( currentWrapperWidth : number , isSingleTransaction ?: boolean ) => {
27
28
const peek = isSingleTransaction ? spacing . p4 . padding : NEXT_TRANSACTION_PEEK ;
28
- const transactionPreviewWidth = currentWidth - spacing . p4 . padding - peek ;
29
+ const transactionPreviewWidth = currentWrapperWidth - spacing . p4 . padding - peek ;
29
30
const minimalWrapperWidth = TRANSACTION_WIDTH_WIDE + spacing . p4 . padding + peek ;
30
31
return {
31
- transactionPreviewStyle : { width : currentWidth > minimalWrapperWidth ? TRANSACTION_WIDTH_WIDE : transactionPreviewWidth } ,
32
+ transactionPreviewStyle : { width : currentWrapperWidth > minimalWrapperWidth ? TRANSACTION_WIDTH_WIDE : transactionPreviewWidth } ,
32
33
componentStyle : [ { maxWidth : 'min(680px, 100%)' } , { width : 'min-content' } ] ,
33
34
expenseCountVisible : transactionPreviewWidth >= TRANSACTION_WIDTH_WIDE ,
34
35
} ;
35
36
} ;
36
37
37
- const getMoneyRequestReportPreviewStyle = ( shouldUseNarrowLayout : boolean , currentWidth ?: number , isSingleTransaction ?: boolean ) : MoneyRequestReportPreviewStyleType => ( {
38
+ const getMoneyRequestReportPreviewStyle = (
39
+ shouldUseNarrowLayout : boolean ,
40
+ currentWidth ?: number ,
41
+ currentWrapperWidth ?: number ,
42
+ isSingleTransaction ?: boolean ,
43
+ ) : MoneyRequestReportPreviewStyleType => ( {
38
44
...componentsSpacing ,
39
- ...( shouldUseNarrowLayout ? mobileStyle ( currentWidth ?? 256 , isSingleTransaction ) : desktopStyle ( currentWidth ?? 1000 , isSingleTransaction ) ) ,
45
+ ...( shouldUseNarrowLayout ? mobileStyle ( currentWidth ?? 256 , isSingleTransaction ) : desktopStyle ( currentWrapperWidth ?? 1000 , isSingleTransaction ) ) ,
40
46
} ) ;
41
47
42
48
export default getMoneyRequestReportPreviewStyle ;
0 commit comments