• Indu

    Indu

    1 year ago
    Just wanted to clarify whether my understanding of LaunchedEffect and rememberUpdatedState is correct. This is an example from Android developer site @Composable fun NotificationHost(state: NotificationState, onTimeout: (Notification) -> Unit) { val currentOnTimeout by rememberUpdatedState(onTimeout) state.currentNotification?.let { currentNotification -> LaunchedEffect(currentNotification) { // We should not restart this delay if onTimeout changes, but we want to call // the onTimeout we were last recomposed with when it completes. delay(NotificationTimeout) currentOnTimeout(currentNotification) } } // ... } -- LaunchedEffect will be executed during initial composition. -- And after that the effect will only run if the effect's parameters change. -- Sometimes the effect refers a value or event callback in its code block which is not passed as a parameter to the effect.( We don't want to restart the effect when the value or the event callback changes) . But we need to remember them during recomposition. Also they need to be updated with the new value or callback during recomposition. So we use rememberUpdatedState. This way if the effect is relaunched when one of its key is updated it will get the updated value or callback which is referred in the effect. -- LaunchedEffect will survive recompositions Thanks
    Indu
    l
    +2
    13 replies
    Copy to Clipboard
  • Jason Ankers

    Jason Ankers

    1 year ago
    How could I prevent scroll gestures from a
    LazyColumn
    inside a bottom sheet from dismissing the sheet? is it possible to disable the sheet swipe gestures within a certain boundary? (in my case I want to disable them over the
    LazyColumn
    )
    Jason Ankers
    Mayank Saini
    4 replies
    Copy to Clipboard
  • pawegio

    pawegio

    1 year ago
    BackHandler
    seems to not intercept system back presses on
    AppCompatActivity
    restart in my case (in nested
    NavHost
    composables). Is it a known issue? 🤔
    pawegio
    Adam Powell
    +1
    5 replies
    Copy to Clipboard
  • Ravi

    Ravi

    1 year ago
    SharedElement transition in Jetpack Compose is possible? Can any one please share sample project. I've found one but its not updated from a long time https://github.com/mobnetic/compose-shared-element
    Ravi
    1 replies
    Copy to Clipboard
  • zhuinden

    zhuinden

    1 year ago
    I'm trying to make SaveableStateProvider work - I have Parcelable immutable data classes as keys (so hashCode/equals) and ensure SavedStateProviders exist while the keys are added, yet I'm still losing the saved state. What am I missing?
    zhuinden
    Andrey Kulikov
    24 replies
    Copy to Clipboard
  • Piotr Prus

    Piotr Prus

    1 year ago
    Compose AndroidView with GoogleMap has an issues on devices with android 6 & 7 (didn’t test android 5 tho). I used sample project Crane for reproduction. You can check below GIF and issueTracker. Anyone has a workaround until fix?https://issuetracker.google.com/issues/182063556
    Piotr Prus
    aiidziis
    2 replies
    Copy to Clipboard
  • Sinan Gunes

    Sinan Gunes

    1 year ago
    I think I am doing something really bad here. Is there a way to see which part of my code effects performance so bad?
    Sinan Gunes
    Arkadii Ivanov
    +1
    5 replies
    Copy to Clipboard
  • o

    Olivier Patry

    1 year ago
    I can't make a 1.dp height linear progress bar
    LinearProgressIndicator(Modifier.fillMaxWidth().height(1.dp))
    The implementation hard codes its size it seems:
    Canvas(
        modifier
            .progressSemantics()
            .size(LinearIndicatorWidth, LinearIndicatorHeight)
            .focusable()
    Any solution?
    o
    o
    +1
    8 replies
    Copy to Clipboard
  • j

    julioromano

    1 year ago
    Is it possible to apply a tint to an
    ImageBitmap
    ?
    j
    Nader Jawad
    6 replies
    Copy to Clipboard
  • Sinan Gunes

    Sinan Gunes

    1 year ago
    1.4.31 is not compatible.
    Sinan Gunes
    d
    +2
    8 replies
    Copy to Clipboard