Skip to content

Commit

Permalink
fix(Bonus Pagamenti Digitali): [#175717738] Fix android goback button…
Browse files Browse the repository at this point in the history
… on BPD Cashback (#2489)

* [#175717738] Fix android goback button on BPD Cashback

* [#175717738] fixes lint

Co-authored-by: fabriziofff <[email protected]>
Co-authored-by: Matteo Boschi <[email protected]>
  • Loading branch information
3 people authored Dec 7, 2020
1 parent d4416fd commit 3bf7b21
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ts/features/bonus/bpd/screens/details/BpdDetailsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { bpdTransactionsForSelectedPeriod } from "../../store/reducers/details/t
import { bpdSelectedPeriodSelector } from "../../store/reducers/details/selectedPeriod";
import { navigateToBpdTransactions } from "../../navigation/actions";
import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp";
import { useHardwareBackButton } from "../../../bonusVacanze/components/hooks/useHardwareBackButton";
import { navigateBack } from "../../../../../store/actions/navigation";
import BpdPeriodSelector from "./BpdPeriodSelector";
import BpdPeriodDetail from "./periods/BpdPeriodDetail";
import GoToTransactions from "./transaction/GoToTransactions";
Expand Down Expand Up @@ -60,6 +62,11 @@ const BpdDetailsScreen: React.FunctionComponent<Props> = props => {
}
}, [props.unsubscription]);

useHardwareBackButton(() => {
props.goBack();
return true;
});

/**
* Display the transactions button when:
* - Period is closed and transactions number is > 0
Expand Down Expand Up @@ -118,7 +125,8 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({
dispatch(bpdUnsubscribeCompleted());
dispatch(NavigationActions.back());
},
goToTransactions: () => dispatch(navigateToBpdTransactions())
goToTransactions: () => dispatch(navigateToBpdTransactions()),
goBack: () => dispatch(navigateBack())
});

const mapStateToProps = (state: GlobalState) => ({
Expand Down

0 comments on commit 3bf7b21

Please sign in to comment.