https://kotlinlang.org logo
Join Slack
Powered by
# compose
  • m

    Mario Loncar

    06/24/2025, 2:39 PM
    Hello, does anyone else have this issue when trying to use exported Compose screen through XCFramework in iOS app?
    n
    • 2
    • 2
  • n

    nika

    06/25/2025, 11:40 AM
    Hi guys I have a question regarding layouts. Why are Row, Column, Box and Layout inline functions? Is it only for avoiding method calls and saving time? Is there some other reason? Why is not SubcomposeLayout also inline?
    s
    • 2
    • 2
  • e

    Eslam Hussein

    06/25/2025, 1:10 PM
    Hi everyone đź‘‹ I'm using Jetpack Compose with Material3 and I want to use a
    ModalBottomSheet
    where: • When partially expanded, it should have a fixed height (e.g. 200.dp) • When fully expanded, it should wrap content or fill the screen using material 3 version 1.3.+
  • r

    RE

    06/25/2025, 1:51 PM
    In Jetpack Compose Text, if a line height is set, when using an
    AnnotatedString
    , if you append text with a size larger than the line height, that line will not automatically become taller but will remain fixed. How to fix? I want to insert inline LaTeX formulas by using
    appendInlineContent
    , but it seems to be limited by the line height.
  • e

    eygraber

    06/25/2025, 6:03 PM
    Is there an ETA for Linux support for the new KMP plugin?
    âž• 4
    s
    r
    • 3
    • 2
  • m

    martmists

    06/25/2025, 8:04 PM
    I'm trying to write a custom client library for Compose, but struggling to figure out how to implement Modifier and various layout components, because it seems I can't reuse the compose-foundation composables and Modifiers? Are there any references on how to approach this?
    k
    s
    i
    • 4
    • 8
  • m

    MR3Y

    06/25/2025, 9:54 PM
    Is there a way to intercept all touch/tap events from all windows I have in my app not just the app/activity main window? I run a specific logic in the Main Activity whenever the user taps on any part of my app's UI. To intercept touch events/user interactions I was overriding
    onUserInteraction
    method in the main activity and run that logic from there. This works for any composable as long as they are in the same activity window but somewhere deep in the hierarchy I have some dialogs that will be shown conditionally. Obviously this interception technique doesn't work with these Dialogs because they live in their own window. Is there a way to achieve what I want globally?
  • n

    Nikhil Parab

    06/26/2025, 11:44 AM
    I have fun with viewModelScope.launch written in viewModel for removing an item from cart, there's a condition in compose item card which disables the remove icon when last part is remaining in the list, but when I click on the remove button on 2 of the last cards, both the items gets removed. I already tried mutex, checking with a mutableStateOf boolean value, adding @Synchronized on the fun, but nothing works ? how should I handle this race condition?
    s
    j
    • 3
    • 24
  • l

    Lukasz Kalnik

    06/26/2025, 12:11 PM
    I have an address text consisting of a street part, a comma and zip code/city part (with possible city districts).
    Some street 1, 10000 MĂĽnchen / Altstadt-Nord
    I want to display it in one line, if it fits. However when it doesn't fit, I want that it breaks at the first comma, so that e.g. the zip code is not in the "street" line, and separate from the city line. I don't want to use non-breaking spaces, because then if the zip code/city part is also longer than one line, it gets broken in the middle of the words.
    m
    d
    • 3
    • 17
  • o

    Oleksandr Balan

    06/26/2025, 2:39 PM
    Am I correct that the Compose compiler cannot infer a
    sealed interface
    as stable, even if all of its implementations are inferred as stable? đź§µ
    • 1
    • 1
  • l

    Lukasz Kalnik

    06/26/2025, 3:21 PM
    I have two lines of text, which have to be in separate
    Text
    composables inside a
    Column
    (they cannot be in an
    annotatedString()
    ). How can I make sure there is still typographicaly correct vertical space between them? Is there some API to get the line spacing from a
    TextStyle
    ?
    k
    • 2
    • 3
  • m

    Mugunthan

    06/26/2025, 8:29 PM
    LazyColumn with Multiple LazyRows Performance Issue I'm facing performance issues with
    LazyColumn
    containing multiple `LazyRow`s in Jetpack Compose on low-spec devices, even in release mode with R8. Issue • Setup:
    LazyColumn
    with 10 `LazyRow`s, each with 10–15 items. • Items Approach: ◦ Loads fast but lags on initial scroll. ◦ Smooth after "warm-up" scroll. ◦ Memory leaks may occur after prolonged scrolling. • For Loop with Column: ◦ Loads slowly, possible memory leaks during loading. ◦ Smooth scrolling after loading. • XML RecyclerView: Smooth loading and scrolling, no lag. • Optimizations Tried: Stable keys, `@Stable`/`@Immutable`, Coil, release mode with R8. Example Code
    Copy code
    @Composable
    fun LazyColumnWithLazyRows() {
        val rows = List(10) { RowItem(it, "Row $it") }
        val itemsPerRow = List(10) { List(10 + it % 6) { RowItem(it, "Item $it") } }
    
        LazyColumn {
            items(rows, key = { it.id }) { row ->
                Text(row.title, fontWeight = FontWeight.Bold)
                LazyRow {
                    items(itemsPerRow[row.id], key = { it.id }) { RowItemView(it) }
                }
            }
        }
    }
    Questions 1. Why does the initial scroll lag on low-spec devices? 2. How to achieve
    RecyclerView
    -like smoothness in Compose? 3. Any optimizations to reduce initial lag and memory leaks? Suggestions appreciated!
    j
    • 2
    • 2
  • b

    Bam

    06/27/2025, 12:58 PM
    Hi all. I have been looking for a good Compose best practice way of triggering local Notifications, but can't seem to find any Compose specific ways of achieving this (in a UI + ViewModel architecture way). I keep finding "Helper Class" or "Accompanist" suggestions, and the Google Android recommendation is not helpful in this regard either. Anyone know of Compose ways of triggering and managing Notifications?
    c
    j
    • 3
    • 10
  • g

    Grigorii Yurkov

    06/27/2025, 4:49 PM
    Why there is an
    offset {}
    modifier that accepts lambda to skip straight to the placement stage, but no
    size {}
    modifier so I can also skip recomposition entirely?
    m
    e
    +2
    • 5
    • 7
  • k

    krzysztof

    06/27/2025, 9:14 PM
    Is there a way to change text underline offset, while using TextDecoration.underline (similar to text-underline-offset in css)?
  • u

    ursus

    06/28/2025, 9:54 AM
    With
    Navigation3
    . do you see a way to adopt it incrementally? Or does it have to be an atomic change for all of the 100 screens in my app?
    h
    s
    m
    • 4
    • 6
  • n

    Nathan Fallet

    06/28/2025, 2:08 PM
    Does anyone know if the library is still maintained? https://github.com/alexzhirkevich/compose-cupertino
    s
    m
    c
    • 4
    • 3
  • t

    Thierry Kh

    06/29/2025, 11:15 AM
    Hey. I've been looking around for an expandable floating action button (basically a fab menu with sub fabs). Does anyone know of some already existing solutions?
    👍 1
    a
    t
    • 3
    • 13
  • d

    Dovydas

    06/29/2025, 6:43 PM
    The Android documentation for navigation suggests to use the following code to navigate using a bottom nav bar:
    Copy code
    onClick = {
                navController.navigate(topLevelRoute.route) {
                  popUpTo(navController.graph.findStartDestination().id) {
                    saveState = true
                  }
                  launchSingleTop = true
                  restoreState = true
                }
              }
    The problem I have with this, is that whenever I go to a screen (even if I've visited it before), it gets recreated with a new viewmodel instance and all state is lost. From my understanding,
    saveState
    argument should save the state to
    SaveStateHandle
    ? which I'm not using in those viewmodels. But isn't there a way to just move the already existing screen and viewmodel to the front when navigating to it again, therefore them not getting recreated.
    • 1
    • 2
  • c

    Christian Ricardo

    06/29/2025, 7:04 PM
    hi! I'm trying to create an application for Android, iOS and Web with compose multiplatform I created a starting project with the web wizard but when I launch the web app running
    ./gradlew wasmJsBrowserDevelopmentRun
    I can't right click on the web to inspect it I found this issue, and I think this web page has the same problem https://passaporteaupair.com/ because I can't right click on it to inspect Does anyone know why this happens and how I can fix it? I didn't find any information, and from what I read here it should be possible https://kotlinlang.org/docs/wasm-debugging.html#debug-your-kotlin-wasm-application
    c
    • 2
    • 1
  • k

    krzysztof

    06/30/2025, 9:11 AM
    how does compose handles conditional remember calls? React has its rules of hooks, where each hook cannot be called conditionally (applying similar positional memoization as compose), so I’m curious if something similar applies here
    s
    s
    • 3
    • 5
  • s

    Slackbot

    06/30/2025, 9:53 AM
    This message was deleted.
    screen-20250630-113912~2.mp4
    k
    d
    • 3
    • 3
  • d

    Dekroo

    06/30/2025, 8:08 PM
    Hi everyone, I'm experiencing an issue where the initial text color in my app isn’t applied correctly - it shows wrong colors at first but changes to the expected black after I minimize and reopen the app. Has anyone encountered this kind of problem before? Any ideas on why this happens and how to fix it?
    Copy code
    @Composable
    fun AppTheme(
        darkTheme: Boolean = isSystemInDarkTheme(),
        dynamicColor: Boolean = true,
        content: @Composable() () -> Unit
    ) {
      val colorScheme = when {
          dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
              val context = LocalContext.current
              if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
          }
    
          darkTheme -> darkScheme
          else -> lightScheme
      }
    
      MaterialTheme(
        colorScheme = colorScheme,
        typography = AppTypography,
        content = content
      )
    }
    --------------- 
    Text(
         text = qrCode,
         modifier = modifier,
         style = MaterialTheme.typography.bodyMedium,
         color = MaterialTheme.colorScheme.onSurface
    )
    b
    • 2
    • 8
  • j

    Jonathan

    06/30/2025, 9:25 PM
    What the recommended way of animating the placement of child
    Composables
    inside of a custom
    Layout {}
    ? I would like to animate the relative positions of child
    Composable
    in my custom Scaffold Composable based the offset of an
    AnchoredDragState
    . Essentially, I would like to slide my nav bar “out of the way” when a sibling
    Composable
    is dragged. I’ve got a POF working using a
    Box
    the
    Modifier.offset { ... }
    on my child
    Composables
    and hardcoded sizes. I would like to be able to wrap this logic up in a custom
    Layout
    and not have to rely on individual offset modifiers and hardcoded sizes. Previously, I tried building this by accessing the offset of a AnchoredDraggableState but dragging became erratic. If anyone has any experience with this, any advice would be appreciated.
    s
    • 2
    • 2
  • d

    Dovydas

    07/01/2025, 6:56 AM
    Hi, I am running into a small issue when using the shared element API with navigation. I want to have a shared background composable between screens. My background is just this:
    Copy code
    Box
      Background (modifier applied to this)
      Content
    When I set the background to be a shared element, it renders in the overlay and above the content during the transition. So I also set
    renderInSharedTransitionScopeOverlay
    for the content, but now it loses it's navigation transitions. Therefore after that I also add
    animateEnterExit
    on the content with the same transition. But that modifier has no context about the difference between pop and push transitions, so I lose my seperate pop transitions. And from there I don't know how to proceed further, my full code is in the thread.
    • 1
    • 1
  • t

    Tim Karagosian

    07/01/2025, 12:43 PM
    Hello all! Old school Android engineer here jumping back into being an engineer and starting a new role soon! I am working on testing my code. In the old Java+XML days about 9 or more years ago I was able to use the UI methods and mock the UI and felt like I could test practically anything. I just struggled a bit trying to get things working for unit tests in my UI Compose classes and I finally was forced to only using the AndroidTest instrument tests. Are there ways of testing my View methods or am I doing it correctly via Instrument testing only and I'm stuck in the past thinking I can do all those tests as Unit Tests? Additionally if I have to have them as instrument tests only, how do I handle the CI/CD for the instrument testing?
    j
    • 2
    • 5
  • r

    Raymond

    07/01/2025, 4:09 PM
    Untitled.cpp
    Untitled.cpp
  • r

    Raymond

    07/01/2025, 4:09 PM
    Hello! Is there a standard way to handle nested scrolling for horizontal RecyclerViews placed inside an Android Fragment that's contained within a compose HorizontalPager? Here's a minimal snippet of code that reproduces the issue:
  • m

    mattinger

    07/01/2025, 4:28 PM
    So, i've been playing with the compose multipreviews, and i wanted to tweak it by creating my own annotations. However, it seems like using the old symbols like
    Devices.TABLET
    is an error, as it's an older form of specifying the device configuration. AS fixes it by inlining the configuration:
    Copy code
    @Preview(device = "spec:width=1280dp,height=800dp,dpi=240")
    I can then add things like
    orientation=portrait
    . This is all well and good, but i'd rather use the built in
    pixel_tablet
    spec and have it rotated to portrait mode. However, i can't figure out if there's a way to do that and then apply landscape mode. The documentation on using these new definitions seems a bit scarce where i'm looking (and the autocomplete only shows
    pixel_5
    in the new type of spec) https://developer.android.com/develop/ui/compose/tooling/previews Anyone have suggestions as to how to do this without a fully custom device specification, and/or any other documentation i might have missed?
  • c

    Colton Idle

    07/02/2025, 12:56 AM
    I'm using navigationBar from m3. Sometimes I will have 4 tabs... sometimes I will have 3 depending on whether the user made a purchase. I have this working, but it looks janky because of how the nav bar icon appears. Is there any way to add some animation to navigationBar when adding an extra tab? My tab code is essentially this from the docs