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
1 changed files with 9 additions and 4 deletions

View File

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