-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Closed
Copy link
Labels
Awaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to productionInternalRequires API changes or must be handled by Expensify staffRequires API changes or must be handled by Expensify staffWeeklyKSv2KSv2
Description
Description
Current State:
- Multiple
VerifyAccountPagecomponents exist for different contexts - Each has hardcoded
backTologic based on the flow it serves - The base component logic is in
VerifyAccountPageBase.tsx - Example existing implementations:
pages/settings/Wallet/VerifyAccountPage/index.tsxpages/settings/Security/TwoFactorAuth/VerifyAccountPage.tsx
Expected State:
- Create a single
DynamicVerifyAccountPagecomponent - Component reuses
VerifyAccountPageBasefor core functionality - Implements dynamic back logic using
getPathWithoutSuffix() - Implements forward logic (static destination or via
FORWARD_TO_MAPPINGS) - No
backToparameter in URL - context comes from the path itself
Implementation:
Create App/src/pages/settings/DynamicVerifyAccountPage.tsx:
import React from 'react';
import Navigation from '@libs/Navigation/Navigation';
import DYNAMIC_ROUTES from '@src/ROUTES';
import VerifyAccountPageBase from './VerifyAccountPageBase';
function getPathWithoutSuffix(dynamicSuffix: string): string {
const path = Navigation.getActiveRoute();
return path ? path.replace(`/${dynamicSuffix}`, '') : ROUTES.HOME;
}
function DynamicVerifyAccountPage() {
const handleGoBack = () => {
const backRoute = getPathWithoutSuffix(DYNAMIC_ROUTES.VERIFY_ACCOUNT.path);
Navigation.goBack(backRoute);
};
return (
<VerifyAccountPageBase
onGoBack={handleGoBack}
onGoForward={handleGoForward}
/>
);
}
export default DynamicVerifyAccountPage;Scope
Files:
App/src/pages/settings/DynamicVerifyAccountPage.tsx(new file)- May need to modify
VerifyAccountPageBase.tsxif it doesn't accept callback props
Dependencies:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Awaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to productionInternalRequires API changes or must be handled by Expensify staffRequires API changes or must be handled by Expensify staffWeeklyKSv2KSv2