Skip to content

Commit

Permalink
refactor goBack function
Browse files Browse the repository at this point in the history
  • Loading branch information
adelloste committed Jan 29, 2024
1 parent 51f31dc commit 186b15e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions ts/features/pn/screens/MessageDetailsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import I18n from "../../../i18n";
import { useIODispatch, useIOSelector } from "../../../store/hooks";
import { UIMessageId } from "../../messages/types";
import { serviceByIdSelector } from "../../../store/reducers/entities/services/servicesById";
import { emptyContextualHelp } from "../../../utils/emptyContextualHelp";
import { useOnFirstRender } from "../../../utils/hooks/useOnFirstRender";
import { MessageDetails } from "../components/MessageDetails";
import { PnParamsList } from "../navigation/params";
Expand Down Expand Up @@ -67,16 +66,17 @@ export const MessageDetailsScreen = () => {
);
const payments = paymentsFromPNMessagePot(currentFiscalCode, messagePot);

const goBack = useCallback(() => {
dispatch(cancelPreviousAttachmentDownload());
dispatch(cancelQueuedPaymentUpdates());
dispatch(cancelPaymentStatusTracking());
navigation.goBack();
}, []);

useHeaderSecondLevel({
title: "",
goBack: () => {
dispatch(cancelPreviousAttachmentDownload());
dispatch(cancelQueuedPaymentUpdates());
dispatch(cancelPaymentStatusTracking());
navigation.goBack();
},
supportRequest: true,
contextualHelp: emptyContextualHelp
goBack,
supportRequest: true
});

useOnFirstRender(() => {
Expand Down

0 comments on commit 186b15e

Please sign in to comment.