Skip to content

Commit

Permalink
revert back to onButton press
Browse files Browse the repository at this point in the history
  • Loading branch information
allroundexperts committed Mar 7, 2025
1 parent f4e5d37 commit 6a8d5b8
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 60 deletions.
20 changes: 10 additions & 10 deletions src/components/ConfirmationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ type ConfirmationPageProps = {
description: React.ReactNode;

/** The text for the primary button label */
primaryButtonText?: string;
buttonText?: string;

/** A function that is called when the primary button is clicked on */
onPrimaryButtonPress?: () => void;
onButtonPress?: () => void;

/** Whether we should show a primary confirmation button */
shouldShowPrimaryButton?: boolean;
shouldShowButton?: boolean;

/** The text for the secondary button label */
secondaryButtonText?: string;
Expand Down Expand Up @@ -60,9 +60,9 @@ function ConfirmationPage({
illustration = LottieAnimations.Fireworks,
heading,
description,
primaryButtonText = '',
onPrimaryButtonPress = () => {},
shouldShowPrimaryButton = false,
buttonText = '',
onButtonPress = () => {},
shouldShowButton = false,
secondaryButtonText = '',
onSecondaryButtonPress = () => {},
shouldShowSecondaryButton = false,
Expand Down Expand Up @@ -96,7 +96,7 @@ function ConfirmationPage({
<Text style={[styles.textHeadline, styles.textAlignCenter, styles.mv2, headingStyle]}>{heading}</Text>
<Text style={[styles.textAlignCenter, descriptionStyle]}>{description}</Text>
</View>
{(shouldShowSecondaryButton || shouldShowPrimaryButton) && (
{(shouldShowSecondaryButton || shouldShowButton) && (
<FixedFooter style={footerStyle}>
{shouldShowSecondaryButton && (
<Button
Expand All @@ -107,15 +107,15 @@ function ConfirmationPage({
onPress={onSecondaryButtonPress}
/>
)}
{shouldShowPrimaryButton && (
{shouldShowButton && (
<Button
success
large
text={primaryButtonText}
text={buttonText}
testID="confirmation-primary-button"
style={styles.mt3}
pressOnEnter
onPress={onPrimaryButtonPress}
onPress={onButtonPress}
/>
)}
</FixedFooter>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/AddPersonalBankAccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ function AddPersonalBankAccountPage() {
<ConfirmationPage
heading={translate('addPersonalBankAccountPage.successTitle')}
description={translate('addPersonalBankAccountPage.successMessage')}
shouldShowPrimaryButton
primaryButtonText={translate('common.continue')}
onPrimaryButtonPress={() => exitFlow(true)}
shouldShowButton
buttonText={translate('common.continue')}
onButtonPress={() => exitFlow(true)}
/>
) : (
<FormProvider
Expand Down
6 changes: 3 additions & 3 deletions src/pages/EnablePayments/ActivateStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ function ActivateStep({userWallet}: ActivateStepProps) {
illustration={animation}
heading={translate(`activateStep.${isActivatedWallet ? 'activated' : 'checkBackLater'}Title`)}
description={translate(`activateStep.${isActivatedWallet ? 'activated' : 'checkBackLater'}Message`)}
shouldShowPrimaryButton={isActivatedWallet}
primaryButtonText={continueButtonText}
onPrimaryButtonPress={() => continueSetup()}
shouldShowButton={isActivatedWallet}
buttonText={continueButtonText}
onButtonPress={() => continueSetup()}
/>
</>
);
Expand Down
6 changes: 3 additions & 3 deletions src/pages/home/report/ReportDetailsExportPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ function ReportDetailsExportPage({route}: ReportDetailsExportPageProps) {
illustration={Illustrations.LaptopwithSecondScreenandHourglass}
heading={translate('workspace.export.notReadyHeading')}
description={translate('workspace.export.notReadyDescription')}
shouldShowPrimaryButton
primaryButtonText={translate('common.buttonConfirm')}
onPrimaryButtonPress={() => Navigation.goBack()}
shouldShowButton
buttonText={translate('common.buttonConfirm')}
onButtonPress={() => Navigation.goBack()}
illustrationStyle={{width: 233, height: 162}}
/>
</ScreenWrapper>
Expand Down
46 changes: 23 additions & 23 deletions src/pages/settings/Security/MergeAccounts/MergeResultPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ function MergeResultPage() {
{translate('mergeAccountsPage.mergeSuccess.successfullyMergedAllData.afterSecondEmail')}
</>
),
primaryButtonText: translate('common.buttonConfirm'),
onPrimaryButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
buttonText: translate('common.buttonConfirm'),
onButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
illustration: LottieAnimations.Fireworks,
},
[CONST.MERGE_ACCOUNT_RESULTS.ERR_NO_EXIST]: {
Expand All @@ -71,8 +71,8 @@ function MergeResultPage() {
{translate('mergeAccountsPage.mergeFailureUncreatedAccount.addContactMethod.afterLink')}
</>
),
onPrimaryButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
primaryButtonText: translate('common.buttonConfirm'),
onButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
buttonText: translate('common.buttonConfirm'),
illustration: Illustrations.LockClosedOrange,
},
[CONST.MERGE_ACCOUNT_RESULTS.ERR_2FA]: {
Expand All @@ -89,8 +89,8 @@ function MergeResultPage() {
</Text>
</>
),
onPrimaryButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
primaryButtonText: translate('common.buttonConfirm'),
onButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
buttonText: translate('common.buttonConfirm'),
illustration: Illustrations.LockClosedOrange,
},
[CONST.MERGE_ACCOUNT_RESULTS.ERR_SMART_SCANNER]: {
Expand All @@ -102,9 +102,9 @@ function MergeResultPage() {
{translate('mergeAccountsPage.mergeFailureSmartScannerAccount.afterEmail')}
</>
),
primaryButtonText: translate('common.buttonConfirm'),
buttonText: translate('common.buttonConfirm'),
illustration: Illustrations.LockClosedOrange,
onPrimaryButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
onButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
},
[CONST.MERGE_ACCOUNT_RESULTS.ERR_SAML_DOMAIN_CONTROL]: {
heading: translate('mergeAccountsPage.mergeFailureGenericHeading'),
Expand All @@ -125,8 +125,8 @@ function MergeResultPage() {
{translate('mergeAccountsPage.mergeFailureSAMLDomainControl.afterLink')}
</>
),
primaryButtonText: translate('common.buttonConfirm'),
onPrimaryButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
buttonText: translate('common.buttonConfirm'),
onButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
illustration: Illustrations.LockClosedOrange,
},
[CONST.MERGE_ACCOUNT_RESULTS.ERR_SAML_NOT_SUPPORTED]: {
Expand All @@ -150,8 +150,8 @@ function MergeResultPage() {
secondaryButtonText: translate('mergeAccountsPage.mergePendingSAML.goToExpensifyClassic'),
onSecondaryButtonPress: () => openOldDotLink(CONST.OLDDOT_URLS.INBOX, false),
shouldShowSecondaryButton: true,
primaryButtonText: translate('common.buttonConfirm'),
onPrimaryButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
buttonText: translate('common.buttonConfirm'),
onButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
illustration: Illustrations.RunningTurtle,
illustrationStyle: {width: 132, height: 150},
},
Expand All @@ -164,8 +164,8 @@ function MergeResultPage() {
{translate('mergeAccountsPage.mergeFailureSAMLAccount.afterEmail')}
</>
),
primaryButtonText: translate('common.buttonConfirm'),
onPrimaryButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
buttonText: translate('common.buttonConfirm'),
onButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
illustration: Illustrations.LockClosedOrange,
},
[CONST.MERGE_ACCOUNT_RESULTS.ERR_ACCOUNT_LOCKED]: {
Expand All @@ -185,8 +185,8 @@ function MergeResultPage() {
{translate('mergeAccountsPage.mergeFailureAccountLocked.afterLink')}
</>
),
primaryButtonText: translate('common.buttonConfirm'),
onPrimaryButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
buttonText: translate('common.buttonConfirm'),
onButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
illustration: Illustrations.LockClosedOrange,
},
[CONST.MERGE_ACCOUNT_RESULTS.ERR_INVOICING]: {
Expand All @@ -198,8 +198,8 @@ function MergeResultPage() {
{translate('mergeAccountsPage.mergeFailureInvoicedAccount.afterEmail')}
</>
),
primaryButtonText: translate('common.buttonConfirm'),
onPrimaryButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
buttonText: translate('common.buttonConfirm'),
onButtonPress: () => Navigation.goBack(ROUTES.SETTINGS_SECURITY),
illustration: Illustrations.LockClosedOrange,
},
};
Expand All @@ -208,12 +208,12 @@ function MergeResultPage() {
const {
heading,
headingStyle,
onPrimaryButtonPress,
onButtonPress,
descriptionStyle,
illustration,
illustrationStyle,
description,
primaryButtonText,
buttonText,
secondaryButtonText,
onSecondaryButtonPress,
shouldShowSecondaryButton,
Expand Down Expand Up @@ -241,9 +241,9 @@ function MergeResultPage() {
containerStyle={{...styles.flexGrow1, ...styles.mt3}}
heading={heading}
headingStyle={headingStyle}
onPrimaryButtonPress={onPrimaryButtonPress}
shouldShowPrimaryButton
primaryButtonText={primaryButtonText}
onButtonPress={onButtonPress}
shouldShowButton
buttonText={buttonText}
shouldShowSecondaryButton={shouldShowSecondaryButton}
secondaryButtonText={secondaryButtonText}
onSecondaryButtonPress={onSecondaryButtonPress}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/settings/Security/TwoFactorAuth/SuccessPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ function SuccessPage({route}: SuccessPageProps) {
illustration={LottieAnimations.Fireworks}
heading={translate('twoFactorAuth.enabled')}
description={translate('twoFactorAuth.congrats')}
shouldShowPrimaryButton
primaryButtonText={translate('common.buttonConfirm')}
onPrimaryButtonPress={() => {
shouldShowButton
buttonText={translate('common.buttonConfirm')}
onButtonPress={() => {
quitAndNavigateBack(route.params?.backTo ?? ROUTES.SETTINGS_2FA_ROOT.getRoute());

if (route.params?.forwardTo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ function Confirmation({onNext}: CustomSubStepProps) {
<ConfirmationPage
heading={translate('addPersonalBankAccountPage.successTitle')}
description={translate('addPersonalBankAccountPage.successMessage')}
shouldShowPrimaryButton
primaryButtonText={translate('common.continue')}
onPrimaryButtonPress={onNext}
shouldShowButton
buttonText={translate('common.continue')}
onButtonPress={onNext}
/>
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/settings/Wallet/TransferBalancePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ function TransferBalancePage() {
? translate('transferAmountPage.transferDetailBankAccount')
: translate('transferAmountPage.transferDetailDebitCard')
}
shouldShowPrimaryButton
primaryButtonText={translate('common.done')}
onPrimaryButtonPress={dismissSuccessfulTransferBalancePage}
shouldShowButton
buttonText={translate('common.done')}
onButtonPress={dismissSuccessfulTransferBalancePage}
/>
</ScreenWrapper>
);
Expand Down
6 changes: 3 additions & 3 deletions src/pages/workspace/downgrade/DowngradeConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ function DowngradeConfirmation({onConfirmDowngrade, policyID}: Props) {
heading={translate('workspace.downgrade.completed.headline')}
description={hasOtherControlWorkspaces ? translate('workspace.downgrade.completed.description') : undefined}
illustration={MushroomTopHat}
shouldShowPrimaryButton
onPrimaryButtonPress={onConfirmDowngrade}
primaryButtonText={translate('workspace.downgrade.completed.gotIt')}
shouldShowButton
onButtonPress={onConfirmDowngrade}
buttonText={translate('workspace.downgrade.completed.gotIt')}
containerStyle={styles.h100}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ function WorkspaceOwnerChangeSuccessPage({route}: WorkspaceOwnerChangeSuccessPag
heading={translate('workspace.changeOwner.successTitle')}
description={translate('workspace.changeOwner.successDescription')}
descriptionStyle={styles.textSupporting}
shouldShowPrimaryButton
primaryButtonText={translate('common.buttonConfirm')}
onPrimaryButtonPress={closePage}
shouldShowButton
buttonText={translate('common.buttonConfirm')}
onButtonPress={closePage}
/>
</ScreenWrapper>
</AccessOrNotFoundWrapper>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/workspace/upgrade/UpgradeConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ function UpgradeConfirmation({policyName, onConfirmUpgrade, isCategorizing, isTr
<ConfirmationPage
heading={translate('workspace.upgrade.completed.headline')}
description={description}
shouldShowPrimaryButton
onPrimaryButtonPress={onConfirmUpgrade}
primaryButtonText={translate('workspace.upgrade.completed.gotIt')}
shouldShowButton
onButtonPress={onConfirmUpgrade}
buttonText={translate('workspace.upgrade.completed.gotIt')}
containerStyle={styles.h100}
/>
);
Expand Down

0 comments on commit 6a8d5b8

Please sign in to comment.