Hi. I’ve got a Page in a NavigationStack, so VPlay creates a back button in the top left corner and (presumably, I haven’t tested this yet) handles Android’s back button to pop the stack and show the previous page. One of my pages has multiple frames, however, and I would like to have the back button in the top left and the Android back button switch to the previous frame if the first one is not already active, and otherwise use the normal behavior of popping the stack. I can easily handle deciding which behavior to apply, and implementing the frame switching behavior, but how can I customize the back button handling? I haven’t found anything that looks like what I’m looking for in the docs.
What I want is something like this:
Page {
onBackPressed: {
if (currentFrame === 0) navigationStack.pop() // or whatever the default behavior is
else currentFrame--
}
}
Ideally I would be able to pass the event to the standard handler somehow in the default case, but if that’s not possible I can just reproduce its behavior manually as well.