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

    min

    11/07/2025, 8:14 AM
    What’s the
    setOwners
    method on
    ComponentActivity
    for? The method calls •
    .setViewTreeLifecycleOwner(this)
    •
    .setViewTreeViewModelStoreOwner(this)
    •
    .setViewTreeSavedStateRegistryOwner(this)
    on the
    window.decorView
    of
    this
    , but its only usage (in the
    setContent
    method) is followed by a call to the
    setContentView
    on the same
    ComponentActivity
    receiver.
    setContentView
    calls
    initializeViewTreeOwners
    ,
    Copy code
    open fun initializeViewTreeOwners() {
        window.decorView.setViewTreeLifecycleOwner(this)
        window.decorView.setViewTreeViewModelStoreOwner(this)
        window.decorView.setViewTreeSavedStateRegistryOwner(this)
        window.decorView.setViewTreeOnBackPressedDispatcherOwner(this)
        window.decorView.setViewTreeFullyDrawnReporterOwner(this)
    }
    which makes the same three calls as
    setOwners
    and then two more
    • 1
    • 1
  • c

    Colton Idle

    11/07/2025, 6:08 PM
    I can't find the docs for something that I know exists. It was compose talking about Role.Checkbox and how you can set that on a row to get better semantics/a11y. But I can't seem to find it. Anyone happen to know what I'm talking about 😅 My google-fu and ai fu is failing me
    c
    • 2
    • 4
  • m

    Mi Re

    11/08/2025, 11:33 AM
    Hi guys, I'm working on a KMP project, but it is probably a Compose problem. ModalBottomSheet + LazyColumn issue: Every other upward scroll dismisses the sheet instead of scrolling the list. Want it to only dismiss when LazyColumn is fully at top.
    Copy code
    ModalBottomSheet(
        onDismissRequest = onDismissRequest,
        dragHandle = {}
    ) {
        Box(modifier = Modifier.fillMaxSize().background(...)) {
            AnimatedContent(content) { 
                // switches between different screens, one has LazyColumn
                LazyColumn(modifier = Modifier.fillMaxSize()) {
                    // scrollable content
                }
            }
        }
    }
    Tried: NestedScrollConnection with onPreScroll/onPostScroll consuming scroll when not at top, tracking scroll state with LaunchedEffect + canScrollBackward, applying nestedScroll to both Box and LazyColumn. Any ideas? 🙏
    r
    • 2
    • 1
  • y

    Yassine Abou

    11/09/2025, 5:34 PM
    I heard hot reload comes bundled with Compose Multiplatform 1.10. Does Navigation 3 come with it too, or do we need to add it individually?
    c
    • 2
    • 2
  • s

    Sargun Vohra

    11/10/2025, 4:12 AM
    x-posting this question about the best way to force Compose to repaint
    ➕ 1
  • v

    Vineet Rathee

    11/10/2025, 6:52 AM
    Need some expert guidance on this -- When using Compose Multiplatform, the UI appears horizontally shrunk compared to the native Android version. Here’s the text style I’m using:
    Copy code
    @Composable
    fun B3TextStyle() = TextStyle(
        fontFamily = proximaNovaFontFamily(),
        fontWeight = FontWeight.Normal,
        fontSize = DimenFont.nonScalingSp(DimenFont.font_14dp),
        color = Colors.color_222222,
        lineHeight = DimenFont.nonScalingSp(DimenFont.font_20dp)
    )
    However, the text looks compressed and narrower on Compose Multiplatform. Has anyone else faced this issue before? Any suggestions on how to fix or match it with the native appearance? when I use the same font on the native XML side, it renders differently compared to when I use it in the multiplatform setup — it appears noticeably compressed horizontally. also shared the image above of the change
    c
    • 2
    • 2
  • m

    Mark

    11/10/2025, 10:28 AM
    Is there a reason why
    AnnotatedString.Builder
    does not support
    delete
    ,
    replace
    etc like
    SpannableStringBuilder
    does? I’m often stuck with this when migrating code from Android to commonMain. Would also be very useful to have access to the underlying text
    String
    . This property is a
    StringBuilder
    but I don’t see why it couldn’t be exposed as a
    String
    so we can do simple checks like what the last
    Char
    is.
  • p

    Piero Silvestri

    11/10/2025, 6:06 PM
    Hi guys! Have you ever tried to create a Compose Multiplatform Library with a UI that will be used in an iOS native project? I would like to have something like this: • Create a multiplatform module "shared-ui" • Create inside it a button "CustomButton" that uses Material3 • Export the module to a library. I would like to use pods on iOS • Install the pods on an iOS project • In the SwiftUI contentView, import the pod and reuse the button. Is it a good practice? If you have a project that implements it, please share with me an example! Thank you all!
  • u

    ursus

    11/11/2025, 12:02 AM
    Why does appending 2 values onto
    SnapshotStateList
    appear atomic? I figured it would recompose twice but does seems to only once. Is it only recomposing come VSync time? Is this guaranteed? (Real use case is navigation 3 where I want to push multiple screens, or rather mutate backstack more deeply and it needs to be in one "transaction")
    i
    • 2
    • 4
  • a

    Angga Ardinata

    11/11/2025, 12:49 AM
    Hi everyone, is there any sample implementing Shared Element Transition along with Navigation3 ? cant find sample anywhere. thanks
    r
    • 2
    • 4
  • a

    Alex Styl

    11/11/2025, 2:47 AM
    I'm going to be that guy, but what does 'alpha' and 'beta' mean in the context of CMP releases? Is that the same as google's libraries? Is alpha good for production but the API might change kind of thing?
  • a

    Alex Styl

    11/11/2025, 4:06 AM
    I noticed how I don't need to run any ios simulators to run ios compose tests. How does that work? is the result the same as running the tests on jvm? The reason why I am asking is because I have a bug on iOS and I cannot figure out how to write a failing test for it. I suspect that running the ios test are not really different than running the jvm tests, and as a result I cannot really test this.
    p
    i
    • 3
    • 6
  • a

    alexhelder

    11/11/2025, 4:15 AM
    In the Google Photos app, one surface appears to have a ripple effect. How could I apply this effect to the top of a bottom sheet?
    c
    • 2
    • 1
  • a

    Anders Kielsholm

    11/11/2025, 8:47 AM
    Have anyone ever tried getting an
    java.lang.InterruptedException
    when rendering previews in Android Studio? I've recently started getting it from one of our previews as a "Render issue" (the stacktrace states that it was thrown at com.android.tools.rendering.classloading.CooperativeInterruptTransformLoopBreaker.checkLoop(CooperativeInterruptTransform.kt:26)), but I have no clue what caused it. And it doesn't happen all the time at all.
  • e

    Ekaterina Volodko [JB]

    11/11/2025, 10:00 AM
    Calling all Compose Multiplatform for Web devs! 🌐 We’re gathering real stories from developers building with Compose Multiplatform for Web. 🗣️ Tell us about your experience – which use case fits your project best? ⚡ Instant web trials 🛠️ Internal applications, such as dashboards and admin panels 🤝 Sharing design system components with colleagues 💡 Or something else? ⚙️ What worked well — and what could be better? 🔗 Share a short note about what you’re building and add a project link if you’d like! The best quotes will be featured on our new Compose Multiplatform for Web landing page to highlight real developer experiences. Drop your thoughts in the thread and help inspire others to try Compose Multiplatform for Web! 💬
    a
    j
    +4
    • 7
    • 8
  • i

    Ivan Samborskii

    11/11/2025, 11:11 PM
    Hey! I’m trying to replicate the scroll behavior of a
    LazyColumn
    similar to what we see in the Gmail app: 1. Pull-to-refresh (PTR) works when the user drags the list with a finger (✅ works by default). 2. PTR indicator doesn’t show when the user scrolls using the mouse wheel (✅ achieved using
    pointerInput
    +
    awaitPointerEventScope
    to detect mouse input and disable PTR indicator). 3. Click-and-drag with a mouse should both scroll the list and trigger PTR — just like dragging with a finger (❌ currently stuck here). I tried adding a
    draggable
    modifier so users can click-and-drag to scroll, but: • There’s no momentum effect - if I scroll fast, the list stops instantly instead of continuing to glide. • It doesn’t trigger PTR either. Has anyone tackled something similar or knows how to achieve point (3)? Any hints or directions would be appreciated 🙏
    • 1
    • 1
  • m

    Mi Re

    11/12/2025, 10:40 AM
    Hey! Can someone tell me why this is happening? There’s snapping on the right side of the carousel. Thanks!
    Copy code
    @OptIn(ExperimentalMaterial3Api::class)
    @Composable
    fun TodayGoalsCarousel(
        modifier: Modifier = Modifier,
        items: List<@Composable CarouselItemScope.(Int) -> Unit>,
        preferredItemWidth: Dp = 180.dp,
        itemSpacing: Dp = 8.dp,
        contentPadding: PaddingValues = PaddingValues(horizontal = 16.dp)
    ) {
        key(items.size) {
            val carouselState = rememberCarouselState(itemCount = { items.size })
            HorizontalMultiBrowseCarousel(
                state = carouselState,
                modifier = modifier
                    .fillMaxWidth()
                    .wrapContentHeight()
                    .padding(vertical = 16.dp),
                preferredItemWidth = preferredItemWidth,
                itemSpacing = itemSpacing,
                contentPadding = contentPadding,
            ) { index ->
                items[index].invoke(this, index)
            }
        }
    }
    Recording 2025-11-12 112241.mp4
    • 1
    • 1
  • i

    Ihor Y

    11/12/2025, 11:07 AM
    Hello everyone, I am developing an iOS application using Kotlin + Compose UI, and I’m seeing a black screen on iOS when switching screens in a Compose Multiplatform app. Looks like a rendering glitch — maybe related to Skia or something else. Has anyone encountered or solved this? Any advice or workaround appreciated! Here’s a short video showing the issue:
    IMG_4429.mp4
    k
    • 2
    • 2
  • m

    Mark

    11/12/2025, 12:31 PM
    What’s the rationale behind
    TextIndent
    indentation values being
    TextUnit
    ? The problem here is that
    TextUnit
    does not scale linearly, so we can’t just double the value to get double the margin size. To fudge it, we need access to the
    Density
    .
    s
    a
    • 3
    • 5
  • j

    Jonathan

    11/12/2025, 2:44 PM
    Has anyone had any luck getting animated WebP working?
    h
    • 2
    • 1
  • p

    Pablichjenkov

    11/12/2025, 3:50 PM
    Isn't reading dimensions or other legacy xml resources files in Android, slow for compose. Shouldn't compose warn about this and promote direct constant/enum declaration/usage of things like dimensions and colors potentially strings, in plain kotlin files.
    y
    j
    +2
    • 5
    • 9
  • a

    alexhelder

    11/13/2025, 1:07 AM
    How can one get this snapping behavior on horizontal scroll (LazyRow?) as shown in this video, like
    LinearSnapHelper
    for
    RecyclerView
    (solved)
    carousel.mp4
    • 1
    • 2
  • a

    Alex Styl

    11/13/2025, 4:04 AM
    Random observation. If compose resources don't get generated for any reason, try
    ./gradlew clean
    and then a rebuild from the IDE. Worked everytime so far PS: It seems like the dependency >has< to be on common
    👍 1
    k
    t
    • 3
    • 12
  • a

    Alex Styl

    11/13/2025, 5:27 AM
    When do compose resources generated? It's been hit or miss here and spent way too much time with fonts not being generated Having issues with the web target
    r
    • 2
    • 2
  • a

    Alex Styl

    11/13/2025, 11:52 AM
    How is compose resources a dependency and not a plugin? can dependencies generate code?
    k
    k
    • 3
    • 4
  • e

    eygraber

    11/14/2025, 5:45 PM
    Does
    SnapshotStateList
    need to be guarded against concurrent modifications? e.g.
    Copy code
    remember {
       derivedStateOf {
        // paging.items is a SnapshotStateList
        paging.items.count { ... }  
      }
    }
    should I be copying the list before iterating over it in the
    derivedStateOf
    , or do the semantics of the snapshot system prevent that view of it from being modified concurrently?
    s
    • 2
    • 2
  • a

    alexhelder

    11/15/2025, 8:15 AM
    Can anyone recommend an implementation of
    TopAppBar
    that simply takes a single Composable (no slots for nav, title, subtitle, actions, etc) and has support for nested scrolling?
    s
    a
    • 3
    • 2
  • b

    bod

    11/15/2025, 6:28 PM
    👋 Trying to use a custom font in a Compose Multiplatform (JVM desktop + Android) project. I have a module
    :ui
    which has the
    jvm()
    target, in it I'm calling
    val myFontFamily = FontFamily(Font(Res.font.myFont, FontWeight.Normal))
    and use it. Then I have
    :desktopApp
    and
    :androidApp
    modules that depend on
    :ui
    . On Desktop it's working as expected but on Android I'm getting
    NoClassDefFoundError: Failed resolution of: Lorg/jetbrains/compose/resources/FontResources_skikoKt;
    What am I missing?
    k
    • 2
    • 3
  • j

    Jonas

    11/16/2025, 11:31 AM
    SupportingPaneScaffold - seekBack 🔙 I am on an endeavour to implement predictive in (CMP). As the implementation was doing nothing I tried to call seekBack directly and noticed that it also does nothing. With debugging I realised that the transition property of the SeekableTransitionState is null. Am I missing a crucial setup step? Has anyone observed a similar behaviour?
    • 1
    • 6
  • a

    abdl

    11/17/2025, 7:25 AM
    help, i use this library (https://github.com/Chaintech-Network/ComposeMultiplatformScreenCapture) in my app for screenshot functionality, but when i want to publish to playstore, there error:
    The following content provider authorities are in use by other developers: network.chaintech.cmp.screenshot.fileprovider
    . How to resolve it, any solution?