2
0
mirror of synced 2025-02-17 00:56:27 +00:00

feat(StatusStackModal): introduce prevAction API

This adds a possible `prevAction` hook to `stackLayout.currentItem`
which is triggered (if it exists) when the stack modal's back button is
hit.
This commit is contained in:
Pascal Precht 2022-07-13 15:00:17 +02:00 committed by r4bbit.eth
parent c0d434bbdf
commit 45d8990067

View File

@ -60,10 +60,15 @@ StatusModal {
rotation: 180 rotation: 180
visible: replaceItem || stackLayout.currentIndex > 0 visible: replaceItem || stackLayout.currentIndex > 0
onClicked: { onClicked: {
if (replaceItem) if (replaceItem) {
replaceItem = null; replaceItem = null;
else } else {
stackLayout.currentIndex--; let prevAction = stackLayout.currentItem.prevAction
stackLayout.currentIndex--;
if (typeof(prevAction) == "function") {
prevAction()
}
}
} }
} }