1
1
import React , { useCallback , useMemo , useState } from 'react' ;
2
+ import { StyleSheet } from 'react-native' ;
3
+ import type { StyleProp , ViewStyle } from 'react-native' ;
2
4
import { useOnyx } from 'react-native-onyx' ;
3
5
import type { OnyxEntry } from 'react-native-onyx' ;
4
6
import ButtonWithDropdownMenu from '@components/ButtonWithDropdownMenu' ;
@@ -27,6 +29,8 @@ type ExportWithDropdownMenuProps = {
27
29
connectionName : ConnectionName ;
28
30
29
31
dropdownAnchorAlignment ?: AnchorAlignment ;
32
+
33
+ wrapperStyle ?: StyleProp < ViewStyle > ;
30
34
} ;
31
35
32
36
function ExportWithDropdownMenu ( {
@@ -37,6 +41,7 @@ function ExportWithDropdownMenu({
37
41
horizontal : CONST . MODAL . ANCHOR_ORIGIN_HORIZONTAL . RIGHT ,
38
42
vertical : CONST . MODAL . ANCHOR_ORIGIN_VERTICAL . TOP ,
39
43
} ,
44
+ wrapperStyle,
40
45
} : ExportWithDropdownMenuProps ) {
41
46
const reportID = report ?. reportID ;
42
47
const styles = useThemeStyles ( ) ;
@@ -50,6 +55,7 @@ function ExportWithDropdownMenu({
50
55
const canBeExported = ReportUtils . canBeExported ( report ) ;
51
56
const isExported = ReportUtils . isExported ( reportActions ) ;
52
57
const hasIntegrationAutoSync = PolicyUtils . hasIntegrationAutoSync ( policy , connectionName ) ;
58
+ const flattenedWrapperStyle = StyleSheet . flatten ( [ styles . flex1 , wrapperStyle ] ) ;
53
59
54
60
const dropdownOptions : Array < DropdownOption < ReportExportType > > = useMemo ( ( ) => {
55
61
const optionTemplate = {
@@ -72,7 +78,7 @@ function ExportWithDropdownMenu({
72
78
...optionTemplate ,
73
79
} ,
74
80
] ;
75
- const exportMethod = exportMethods ?. [ report ?. policyID ?? '' ] ?? null ;
81
+ const exportMethod = report ?. policyID ? exportMethods ?. [ report . policyID ] : null ;
76
82
if ( exportMethod ) {
77
83
options . sort ( ( method ) => ( method . value === exportMethod ? - 1 : 0 ) ) ;
78
84
}
@@ -124,7 +130,7 @@ function ExportWithDropdownMenu({
124
130
onOptionSelected = { ( { value} ) => savePreferredExportMethod ( value ) }
125
131
options = { dropdownOptions }
126
132
style = { [ shouldUseNarrowLayout && styles . flexGrow1 ] }
127
- wrapperStyle = { styles . flex1 }
133
+ wrapperStyle = { flattenedWrapperStyle }
128
134
buttonSize = { CONST . DROPDOWN_BUTTON_SIZE . MEDIUM }
129
135
/>
130
136
< ConfirmModal
0 commit comments