@@ -5,17 +5,20 @@ import Button from '@components/Button';
55import DestinationPicker from '@components/DestinationPicker' ;
66import FixedFooter from '@components/FixedFooter' ;
77import * as Illustrations from '@components/Icon/Illustrations' ;
8+ import ScreenWrapper from '@components/ScreenWrapper' ;
89import type { ListItem } from '@components/SelectionList/types' ;
910import WorkspaceEmptyStateSection from '@components/WorkspaceEmptyStateSection' ;
1011import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' ;
1112import useLocalize from '@hooks/useLocalize' ;
1213import useNetwork from '@hooks/useNetwork' ;
1314import useOnyx from '@hooks/useOnyx' ;
15+ import useSafeAreaInsets from '@hooks/useSafeAreaInsets' ;
1416import useTheme from '@hooks/useTheme' ;
1517import useThemeStyles from '@hooks/useThemeStyles' ;
1618import Navigation from '@libs/Navigation/Navigation' ;
1719import { getPerDiemCustomUnit , isPolicyAdmin } from '@libs/PolicyUtils' ;
1820import { getPolicyExpenseChat } from '@libs/ReportUtils' ;
21+ import variables from '@styles/variables' ;
1922import {
2023 clearSubrates ,
2124 getIOURequestPolicyID ,
@@ -55,7 +58,7 @@ function IOURequestStepDestination({
5558 const [ policy , policyMetadata ] = useOnyx ( `${ ONYXKEYS . COLLECTION . POLICY } ${ explicitPolicyID ?? getIOURequestPolicyID ( transaction , report ) } ` , { canBeMissing : false } ) ;
5659 const { accountID} = useCurrentUserPersonalDetails ( ) ;
5760 const policyExpenseReport = policy ?. id ? getPolicyExpenseChat ( accountID , policy . id ) : undefined ;
58-
61+ const { top } = useSafeAreaInsets ( ) ;
5962 const customUnit = getPerDiemCustomUnit ( policy ) ;
6063 const selectedDestination = transaction ?. comment ?. customUnit ?. customUnitRateID ;
6164
@@ -112,56 +115,62 @@ function IOURequestStepDestination({
112115 } ;
113116
114117 return (
115- < StepScreenWrapper
116- headerTitle = { backTo ? translate ( 'common.destination' ) : tabTitles [ iouType ] }
117- onBackButtonPress = { navigateBack }
118- shouldShowWrapper = { ! openedFromStartPage }
119- shouldShowNotFoundPage = { shouldShowNotFoundPage }
120- testID = { IOURequestStepDestination . displayName }
118+ < ScreenWrapper
119+ includePaddingTop = { false }
120+ keyboardVerticalOffset = { variables . contentHeaderHeight + top + variables . tabSelectorButtonHeight + variables . tabSelectorButtonPadding }
121+ testID = { `${ IOURequestStepDestination . displayName } Wrap` }
121122 >
122- { isLoading && (
123- < ActivityIndicator
124- size = { CONST . ACTIVITY_INDICATOR_SIZE . LARGE }
125- style = { [ styles . flex1 ] }
126- color = { theme . spinner }
127- />
128- ) }
129- { shouldShowOfflineView && < FullPageOfflineBlockingView > { null } </ FullPageOfflineBlockingView > }
130- { shouldShowEmptyState && (
131- < View style = { [ styles . flex1 ] } >
132- < WorkspaceEmptyStateSection
133- shouldStyleAsCard = { false }
134- icon = { Illustrations . EmptyStateExpenses }
135- title = { translate ( 'workspace.perDiem.emptyList.title' ) }
136- subtitle = { translate ( 'workspace.perDiem.emptyList.subtitle' ) }
137- containerStyle = { [ styles . flex1 , styles . justifyContentCenter ] }
123+ < StepScreenWrapper
124+ headerTitle = { backTo ? translate ( 'common.destination' ) : tabTitles [ iouType ] }
125+ onBackButtonPress = { navigateBack }
126+ shouldShowWrapper = { ! openedFromStartPage }
127+ shouldShowNotFoundPage = { shouldShowNotFoundPage }
128+ testID = { IOURequestStepDestination . displayName }
129+ >
130+ { isLoading && (
131+ < ActivityIndicator
132+ size = { CONST . ACTIVITY_INDICATOR_SIZE . LARGE }
133+ style = { [ styles . flex1 ] }
134+ color = { theme . spinner }
135+ />
136+ ) }
137+ { shouldShowOfflineView && < FullPageOfflineBlockingView > { null } </ FullPageOfflineBlockingView > }
138+ { shouldShowEmptyState && (
139+ < View style = { [ styles . flex1 ] } >
140+ < WorkspaceEmptyStateSection
141+ shouldStyleAsCard = { false }
142+ icon = { Illustrations . EmptyStateExpenses }
143+ title = { translate ( 'workspace.perDiem.emptyList.title' ) }
144+ subtitle = { translate ( 'workspace.perDiem.emptyList.subtitle' ) }
145+ containerStyle = { [ styles . flex1 , styles . justifyContentCenter ] }
146+ />
147+ { isPolicyAdmin ( policy ) && ! ! policy ?. areCategoriesEnabled && (
148+ < FixedFooter style = { [ styles . mtAuto , styles . pt5 ] } >
149+ < Button
150+ large
151+ success
152+ style = { [ styles . w100 ] }
153+ onPress = { ( ) => {
154+ InteractionManager . runAfterInteractions ( ( ) => {
155+ Navigation . navigate ( ROUTES . WORKSPACE_PER_DIEM . getRoute ( policy . id , Navigation . getActiveRoute ( ) ) ) ;
156+ } ) ;
157+ } }
158+ text = { translate ( 'workspace.perDiem.editPerDiemRates' ) }
159+ pressOnEnter
160+ />
161+ </ FixedFooter >
162+ ) }
163+ </ View >
164+ ) }
165+ { ! shouldShowEmptyState && ! isLoading && ! shouldShowOfflineView && ! ! policy ?. id && (
166+ < DestinationPicker
167+ selectedDestination = { selectedDestination }
168+ policyID = { policy . id }
169+ onSubmit = { updateDestination }
138170 />
139- { isPolicyAdmin ( policy ) && ! ! policy ?. areCategoriesEnabled && (
140- < FixedFooter style = { [ styles . mtAuto , styles . pt5 ] } >
141- < Button
142- large
143- success
144- style = { [ styles . w100 ] }
145- onPress = { ( ) => {
146- InteractionManager . runAfterInteractions ( ( ) => {
147- Navigation . navigate ( ROUTES . WORKSPACE_PER_DIEM . getRoute ( policy . id , Navigation . getActiveRoute ( ) ) ) ;
148- } ) ;
149- } }
150- text = { translate ( 'workspace.perDiem.editPerDiemRates' ) }
151- pressOnEnter
152- />
153- </ FixedFooter >
154- ) }
155- </ View >
156- ) }
157- { ! shouldShowEmptyState && ! isLoading && ! shouldShowOfflineView && ! ! policy ?. id && (
158- < DestinationPicker
159- selectedDestination = { selectedDestination }
160- policyID = { policy . id }
161- onSubmit = { updateDestination }
162- />
163- ) }
164- </ StepScreenWrapper >
171+ ) }
172+ </ StepScreenWrapper >
173+ </ ScreenWrapper >
165174 ) ;
166175}
167176
0 commit comments