Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 12 additions & 23 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ const DYNAMIC_ROUTES = {
path: 'visibility',
entryScreens: [SCREENS.REPORT_SETTINGS.ROOT],
},
POLICY_ACCOUNTING_XERO_EXPORT_BANK_ACCOUNT_SELECT: {
path: 'bank-account-select',
entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT],
},
POLICY_ACCOUNTING_XERO_BILL_STATUS_SELECTOR: {
path: 'purchase-bill-status-selector',
entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT],
},
POLICY_ACCOUNTING_XERO_ACCOUNTING_METHOD: {
path: 'accounting-method',
entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.XERO_AUTO_SYNC],
},
ADDRESS_COUNTRY: {
path: 'country',
entryScreens: [
Expand Down Expand Up @@ -3358,12 +3370,6 @@ const ROUTES = {
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`workspaces/${policyID}/accounting/xero/export/purchase-bill-date-select` as const, backTo),
},
POLICY_ACCOUNTING_XERO_EXPORT_BANK_ACCOUNT_SELECT: {
route: 'workspaces/:policyID/accounting/xero/export/bank-account-select',

// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`workspaces/${policyID}/accounting/xero/export/bank-account-select` as const, backTo),
},
POLICY_ACCOUNTING_XERO_ADVANCED: {
route: 'workspaces/:policyID/accounting/xero/advanced',
getRoute: (policyID: string | undefined) => {
Expand All @@ -3388,23 +3394,6 @@ const ROUTES = {
return getUrlWithBackToParam(`workspaces/${policyID}/accounting/xero/advanced/autosync` as const, backTo);
},
},
POLICY_ACCOUNTING_XERO_ACCOUNTING_METHOD: {
route: 'workspaces/:policyID/accounting/xero/advanced/autosync/accounting-method',
getRoute: (policyID: string | undefined, backTo?: string) => {
if (!policyID) {
Log.warn('Invalid policyID is used to build the POLICY_ACCOUNTING_XERO_ACCOUNTING_METHOD route');
}

// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
return getUrlWithBackToParam(`workspaces/${policyID}/accounting/xero/advanced/autosync/accounting-method` as const, backTo);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had these prefixed like advanced/autosync/ etc. for different URLs. Are we not going to have those?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We’re using entry screens in the routing now, so we don’t need those prefixes like advanced/autosync/ anymore.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree with your comment, the prefixes weren't added for routing. They were a part of the design doc. I think @mjasikowski would be best to confirm here, instead of @collectioneur.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mananjadhav We actually don't need to carry over the prefixes from the static route here. While the design doc used verify-account as an example, the only real rule for dynamic suffixes is that they should logically flow with the basePath and clearly reflect the user's current context. Plus, if we can keep the suffix shorter, we should definitely go for it! So, for this and future cases, there's no need to perfectly mirror the static routes. Everything looks great here 🙂

},
},
POLICY_ACCOUNTING_XERO_BILL_STATUS_SELECTOR: {
route: 'workspaces/:policyID/accounting/xero/export/purchase-bill-status-selector',

// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
getRoute: (policyID: string, backTo?: string) => getUrlWithBackToParam(`workspaces/${policyID}/accounting/xero/export/purchase-bill-status-selector` as const, backTo),
},
POLICY_ACCOUNTING_XERO_INVOICE_SELECTOR: {
route: 'workspaces/:policyID/accounting/xero/advanced/invoice-account-selector',
getRoute: (policyID: string | undefined) => {
Expand Down
6 changes: 3 additions & 3 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,12 +567,12 @@ const SCREENS = {
XERO_EXPORT_PURCHASE_BILL_DATE_SELECT: 'Policy_Accounting_Xero_Export_Purchase_Bill_Date_Select',
XERO_ADVANCED: 'Policy_Accounting_Xero_Advanced',
XERO_AUTO_SYNC: 'Policy_Accounting_Xero_Auto_Sync',
XERO_ACCOUNTING_METHOD: 'Policy_Accounting_Xero_Accounting_Method',
XERO_BILL_STATUS_SELECTOR: 'Policy_Accounting_Xero_Export_Bill_Status_Selector',
DYNAMIC_XERO_ACCOUNTING_METHOD: 'Dynamic_Policy_Accounting_Xero_Accounting_Method',
DYNAMIC_XERO_BILL_STATUS_SELECTOR: 'Dynamic_Policy_Accounting_Xero_Export_Bill_Status_Selector',
XERO_INVOICE_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Invoice_Account_Selector',
XERO_EXPORT_PREFERRED_EXPORTER_SELECT: 'Workspace_Accounting_Xero_Export_Preferred_Exporter_Select',
XERO_BILL_PAYMENT_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Bill_Payment_Account_Selector',
XERO_EXPORT_BANK_ACCOUNT_SELECT: 'Policy_Accounting_Xero_Export_Bank_Account_Select',
DYNAMIC_XERO_EXPORT_BANK_ACCOUNT_SELECT: 'Dynamic_Policy_Accounting_Xero_Export_Bank_Account_Select',
NETSUITE_IMPORT_MAPPING: 'Policy_Accounting_NetSuite_Import_Mapping',
NETSUITE_IMPORT_CUSTOM_FIELD: 'Policy_Accounting_NetSuite_Import_Custom_Field',
NETSUITE_IMPORT_CUSTOM_FIELD_VIEW: 'Policy_Accounting_NetSuite_Import_Custom_Field_View',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -667,13 +667,14 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/xero/export/XeroExportConfigurationPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PURCHASE_BILL_DATE_SELECT]: () =>
require<ReactComponentModule>('../../../../pages/workspace/accounting/xero/export/XeroPurchaseBillDateSelectPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_BANK_ACCOUNT_SELECT]: () =>
require<ReactComponentModule>('../../../../pages/workspace/accounting/xero/export/XeroBankAccountSelectPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_EXPORT_BANK_ACCOUNT_SELECT]: () =>
require<ReactComponentModule>('../../../../pages/workspace/accounting/xero/export/DynamicXeroBankAccountSelectPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/xero/advanced/XeroAdvancedPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_AUTO_SYNC]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/xero/advanced/XeroAutoSyncPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_ACCOUNTING_METHOD]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/xero/advanced/XeroAccountingMethodPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_STATUS_SELECTOR]: () =>
require<ReactComponentModule>('../../../../pages/workspace/accounting/xero/export/XeroPurchaseBillStatusSelectorPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_ACCOUNTING_METHOD]: () =>
require<ReactComponentModule>('../../../../pages/workspace/accounting/xero/advanced/DynamicXeroAccountingMethodPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_BILL_STATUS_SELECTOR]: () =>
require<ReactComponentModule>('../../../../pages/workspace/accounting/xero/export/DynamicXeroPurchaseBillStatusSelectorPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR]: () =>
require<ReactComponentModule>('../../../../pages/workspace/accounting/xero/advanced/XeroInvoiceAccountSelectorPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT]: () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ const WORKSPACE_TO_RHP: Partial<Record<keyof WorkspaceSplitNavigatorParamList, s
SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED,
SCREENS.WORKSPACE.ACCOUNTING.CLAIM_OFFER,
SCREENS.WORKSPACE.ACCOUNTING.XERO_AUTO_SYNC,
SCREENS.WORKSPACE.ACCOUNTING.XERO_ACCOUNTING_METHOD,
SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_STATUS_SELECTOR,
SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_ACCOUNTING_METHOD,
SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_BILL_STATUS_SELECTOR,
SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR,
SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT,
SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_PAYMENT_ACCOUNT_SELECTOR,
SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_BANK_ACCOUNT_SELECT,
SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_EXPORT_BANK_ACCOUNT_SELECT,
SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_SUBSIDIARY_SELECTOR,
SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_REUSE_EXISTING_CONNECTIONS,
SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_TOKEN_INPUT,
Expand Down
6 changes: 3 additions & 3 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -654,12 +654,12 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
[SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES]: {path: ROUTES.POLICY_ACCOUNTING_XERO_TAXES.route},
[SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT]: {path: ROUTES.POLICY_ACCOUNTING_XERO_EXPORT.route},
[SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PURCHASE_BILL_DATE_SELECT]: {path: ROUTES.POLICY_ACCOUNTING_XERO_EXPORT_PURCHASE_BILL_DATE_SELECT.route},
[SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_BANK_ACCOUNT_SELECT]: {path: ROUTES.POLICY_ACCOUNTING_XERO_EXPORT_BANK_ACCOUNT_SELECT.route},
[SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_EXPORT_BANK_ACCOUNT_SELECT]: DYNAMIC_ROUTES.POLICY_ACCOUNTING_XERO_EXPORT_BANK_ACCOUNT_SELECT.path,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED]: {path: ROUTES.POLICY_ACCOUNTING_XERO_ADVANCED.route},
[SCREENS.WORKSPACE.ACCOUNTING.CLAIM_OFFER]: {path: ROUTES.POLICY_ACCOUNTING_CLAIM_OFFER.route},
[SCREENS.WORKSPACE.ACCOUNTING.XERO_AUTO_SYNC]: {path: ROUTES.POLICY_ACCOUNTING_XERO_AUTO_SYNC.route},
[SCREENS.WORKSPACE.ACCOUNTING.XERO_ACCOUNTING_METHOD]: {path: ROUTES.POLICY_ACCOUNTING_XERO_ACCOUNTING_METHOD.route},
[SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_STATUS_SELECTOR]: {path: ROUTES.POLICY_ACCOUNTING_XERO_BILL_STATUS_SELECTOR.route},
[SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_ACCOUNTING_METHOD]: DYNAMIC_ROUTES.POLICY_ACCOUNTING_XERO_ACCOUNTING_METHOD.path,
[SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_BILL_STATUS_SELECTOR]: DYNAMIC_ROUTES.POLICY_ACCOUNTING_XERO_BILL_STATUS_SELECTOR.path,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR]: {path: ROUTES.POLICY_ACCOUNTING_XERO_INVOICE_SELECTOR.route},
[SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT]: {path: ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_SELECT.route},
[SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_PAYMENT_ACCOUNT_SELECTOR]: {path: ROUTES.POLICY_ACCOUNTING_XERO_BILL_PAYMENT_ACCOUNT_SELECTOR.route},
Expand Down
11 changes: 5 additions & 6 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -901,15 +901,14 @@ type SettingsNavigatorParamList = {
policyID: string;
integration: string;
};
[SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_STATUS_SELECTOR]: {
[SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_BILL_STATUS_SELECTOR]: {
policyID: string;
// eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md
backTo?: Routes;
};
[SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_BANK_ACCOUNT_SELECT]: {
[SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_ACCOUNTING_METHOD]: {
policyID: string;
};
[SCREENS.WORKSPACE.ACCOUNTING.DYNAMIC_XERO_EXPORT_BANK_ACCOUNT_SELECT]: {
policyID: string;
// eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md
backTo?: Routes;
};
[SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR]: {
policyID: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {ListItem} from '@components/SelectionList/types';
import SelectionScreen from '@components/SelectionScreen';
import type {SelectorType} from '@components/SelectionScreen';
import Text from '@components/Text';
import useDynamicBackPath from '@hooks/useDynamicBackPath';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import {updateXeroAccountingMethod} from '@libs/actions/connections/Xero';
Expand All @@ -16,21 +17,16 @@ import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnec
import withPolicyConnections from '@pages/workspace/withPolicyConnections';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import type {Route} from '@src/ROUTES';
import ROUTES from '@src/ROUTES';
import {DYNAMIC_ROUTES} from '@src/ROUTES';

type MenuListItem = ListItem & {
value: ValueOf<typeof COMMON_CONST.INTEGRATIONS.ACCOUNTING_METHOD>;
};

type XeroAccountingMethodPageRouteParams = {
backTo?: Route;
};

function XeroAccountingMethodPage({policy, route}: WithPolicyConnectionsProps) {
function DynamicXeroAccountingMethodPage({policy}: WithPolicyConnectionsProps) {
const {translate} = useLocalize();
const policyID = policy?.id;
const {backTo} = route.params as XeroAccountingMethodPageRouteParams;
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.POLICY_ACCOUNTING_XERO_ACCOUNTING_METHOD.path);
const styles = useThemeStyles();
const config = policy?.connections?.xero?.config;
const accountingMethod = config?.export?.accountingMethod ?? COMMON_CONST.INTEGRATIONS.ACCOUNTING_METHOD.CASH;
Expand Down Expand Up @@ -59,9 +55,9 @@ function XeroAccountingMethodPage({policy, route}: WithPolicyConnectionsProps) {
if (row.value !== accountingMethod) {
updateXeroAccountingMethod(policyID, row.value, accountingMethod);
}
Navigation.goBack(ROUTES.POLICY_ACCOUNTING_XERO_AUTO_SYNC.getRoute(policyID, backTo));
Navigation.goBack(backPath);
},
[accountingMethod, policyID, backTo],
[accountingMethod, policyID, backPath],
);

return (
Expand All @@ -76,12 +72,12 @@ function XeroAccountingMethodPage({policy, route}: WithPolicyConnectionsProps) {
policyID={policyID}
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
onBackButtonPress={() => Navigation.goBack(ROUTES.POLICY_ACCOUNTING_XERO_AUTO_SYNC.getRoute(policyID, backTo))}
onBackButtonPress={() => Navigation.goBack(backPath)}
connectionName={CONST.POLICY.CONNECTIONS.NAME.XERO}
pendingAction={pendingAction}
shouldBeBlocked={!config?.autoSync?.enabled}
/>
);
}

export default withPolicyConnections(XeroAccountingMethodPage);
export default withPolicyConnections(DynamicXeroAccountingMethodPage);
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import {updateXeroAutoSync} from '@libs/actions/connections/Xero';
import {getLatestErrorField} from '@libs/ErrorUtils';
import createDynamicRoute from '@libs/Navigation/helpers/dynamicRoutesUtils/createDynamicRoute';
import Navigation from '@libs/Navigation/Navigation';
import {settingsPendingAction} from '@libs/PolicyUtils';
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
Expand All @@ -18,7 +19,7 @@ import {clearXeroErrorField} from '@userActions/Policy/Policy';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import type {Route} from '@src/ROUTES';
import ROUTES from '@src/ROUTES';
import ROUTES, {DYNAMIC_ROUTES} from '@src/ROUTES';

type XeroAutoSyncPageRouteParams = {
backTo?: Route;
Expand Down Expand Up @@ -85,7 +86,7 @@ function XeroAutoSyncPage({policy, route}: WithPolicyConnectionsProps) {
}
description={translate('workspace.xero.accountingMethods.label')}
shouldShowRightIcon
onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_XERO_ACCOUNTING_METHOD.getRoute(policyID, backTo))}
onPress={() => Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.POLICY_ACCOUNTING_XERO_ACCOUNTING_METHOD.path))}
/>
</OfflineWithFeedback>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
import {useRoute} from '@react-navigation/native';
import React, {useCallback, useMemo} from 'react';
import {View} from 'react-native';
import BlockingView from '@components/BlockingViews/BlockingView';
import RadioListItem from '@components/SelectionList/ListItem/RadioListItem';
import type {SelectorType} from '@components/SelectionScreen';
import SelectionScreen from '@components/SelectionScreen';
import Text from '@components/Text';
import useDynamicBackPath from '@hooks/useDynamicBackPath';
import {useMemoizedLazyIllustrations} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import {clearXeroErrorField} from '@libs/actions/Policy/Policy';
import {getLatestErrorField} from '@libs/ErrorUtils';
import Navigation from '@libs/Navigation/Navigation';
import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types';
import type {SettingsNavigatorParamList} from '@libs/Navigation/types';
import {getXeroBankAccounts, settingsPendingAction} from '@libs/PolicyUtils';
import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections';
import withPolicyConnections from '@pages/workspace/withPolicyConnections';
import variables from '@styles/variables';
import {updateXeroExportNonReimbursableAccount} from '@userActions/connections/Xero';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import {DYNAMIC_ROUTES} from '@src/ROUTES';

function XeroBankAccountSelectPage({policy}: WithPolicyConnectionsProps) {
function DynamicXeroBankAccountSelectPage({policy}: WithPolicyConnectionsProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const illustrations = useMemoizedLazyIllustrations(['Telescope']);
Expand All @@ -36,12 +33,11 @@ function XeroBankAccountSelectPage({policy}: WithPolicyConnectionsProps) {
() => getXeroBankAccounts(policy ?? undefined, config?.export?.nonReimbursableAccount || bankAccounts?.[0]?.id),
[config?.export?.nonReimbursableAccount, policy, bankAccounts],
);
const route = useRoute<PlatformStackRouteProp<SettingsNavigatorParamList, typeof SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_STATUS_SELECTOR>>();
const backTo = route.params?.backTo;
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.POLICY_ACCOUNTING_XERO_EXPORT_BANK_ACCOUNT_SELECT.path);

const goBack = useCallback(() => {
Navigation.goBack(backTo ?? (policyID && ROUTES.POLICY_ACCOUNTING_XERO_EXPORT.getRoute(policyID)));
}, [policyID, backTo]);
Navigation.goBack(backPath);
}, [backPath]);

const listHeaderComponent = useMemo(
() => (
Expand Down Expand Up @@ -101,4 +97,4 @@ function XeroBankAccountSelectPage({policy}: WithPolicyConnectionsProps) {
);
}

export default withPolicyConnections(XeroBankAccountSelectPage);
export default withPolicyConnections(DynamicXeroBankAccountSelectPage);
Loading
Loading