This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Content(backPress: Backpress) { | |
// ... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Content(backPress: Backpress) { | |
var backStack by +state<BackStack<Routing>> { BackStack(Routing.AlbumList) } | |
if (backPress.triggered) { | |
backStack = backStack.pop() | |
backPress.triggered = false | |
} | |
// remainder omitted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A [back stack of 1 element] | |
└── B [back stack of 2 elements] | |
└── C [back stack of 4 elements] | |
└── D [back stack of 1 element] | |
└── ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A [back stack of 1 element] | |
└── B [back stack of 1 element] | |
└── C [back stack of 1 element] | |
└── D [back stack of 1 element] | |
└── ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun SomeParent(backPress: Backpress, cantPopBackStack: () -> Unit) { | |
var backStack by +state<BackStack<Routing>> { BackStack(Routing.Hello) } | |
if (backPress.triggered) { | |
if (!backStack.pop()) { | |
cantPopBackStack() | |
} | |
backPress.triggered = false | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Content(backPress: Backpress, cantPopBackStack: () -> Unit) { | |
// remainder omitted | |
SomeChild.Content( | |
backPress = backPress | |
// SomeChild’s fallback will be: | |
cantPopBackStack = { | |
// This is parent’s back stack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Content(backPress: Backpress, cantPopBackStack: () -> Unit) { | |
if (backPress.triggered) { | |
cantPopBackStack() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Content(backPress: Backpress, cantPopBackStack: () -> Unit) { | |
// remainder omitted | |
SomeChild1.Content( | |
backPress = backPress, | |
cantPopBackStack = { | |
if (!backStack.pop()) { | |
cantPopBackStack() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Content(backPress: Backpress, cantPopBackStack: () -> Unit) { | |
// remainder omitted | |
var unhandledCount = +memo { State(0) } | |
val nbChildren = 2 | |
val cantPopBackStackDelegate = { | |
// if we tried all of them and failed... | |
if (++unhandledCount.value == nbChildren) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A [Ambient provided with value: X] | |
└── B ... | |
└── C ... | |
└── D ... | |
└── E [Ambient read: X] |