Skip to content

Problem with RevealScope on hierarchy of components #33

Closed Answered by svenjacobs
jayesh408 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello Jayesh, I understand your problem 😃

As of version 0.0.14 it is not required anymore to only have one Reveal instance at the root of your compose hierarchy. You can have one Reveal instance per module or even per screen. Does this solve your problem?

Also if you need to pass down the RevealScope but the function already has a context receiver and as long as Kotlin does not support multiple context receivers, you can work around it by passing down the scope as a parameter like this:

Reveal(…) {
  Box {
    SomeComposable(
      revealScope = this@Reveal
   )
}

@Composable
fun BoxScope.SomeComposable(
  revealScope: RevealScope,
) {
  Text(
    modifier = with(revealScope) { Modifier.…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@jayesh408
Comment options

@svenjacobs
Comment options

@jayesh408
Comment options

Answer selected by svenjacobs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #32 on March 09, 2023 16:53.