Skip to content

Commit

Permalink
API tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbanes committed Apr 10, 2024
1 parent eb1b654 commit d3e89bc
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ public fun <R : Record> NavigableCircuitContent(
LocalBackStack provides backStack,
*providedLocals,
) {
provider.content(record, backStack)
provider.content(
record,
// presenterEnabled. We only enable the presenter for the top record
backStack.topRecord == record,
)
}
}
}
Expand All @@ -139,7 +143,7 @@ public fun <R : Record> NavigableCircuitContent(
@Immutable
public class RecordContentProvider<R : Record>(
public val record: R,
internal val content: @Composable (R, BackStack<R>) -> Unit,
internal val content: @Composable (R, Boolean) -> Unit,
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
Expand Down Expand Up @@ -183,15 +187,15 @@ private fun <R : Record> BackStack<R>.buildCircuitContentProviders(
RecordContentProvider(
record = record,
content =
movableContentOf { record, backStack ->
movableContentOf { record, presenterEnabled ->
CircuitContent(
screen = record.screen,
modifier = Modifier,
navigator = lastNavigator,
circuit = lastCircuit,
unavailableContent = lastUnavailableRoute,
key = record.key,
presenterEnabled = backStack.topRecord == record,
presenterEnabled = presenterEnabled,
)
},
)
Expand Down

0 comments on commit d3e89bc

Please sign in to comment.