https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
compose
  • a

    agrosner

    12/08/2021, 1:25 PM
    Will future versions of compose be cross compatible with multiple kotlin versions?
    s
    • 2
    • 4
  • j

    Javier

    12/08/2021, 1:47 PM
    Please, really please, fix this issue to stop getting notifications from +1 people 🙏 https://issuetracker.google.com/issues/160665122
    1️⃣ 2
    :plus1: 2
    :plus-one: 7
    ➕ 2
    t
    c
    +2
    • 5
    • 7
  • n

    nglauber

    12/08/2021, 2:49 PM
    hi. question regarding Navigation from Notification and keep backstack. My
    MainActivity
    is running and has the
    ScreenA
    and
    ScreenB
    in the backstack. If the user press the notification I would like to keep the
    MainActivity
    opened just adding the
    ScreenC
    to the backstack… Is there a way to do that?
    i
    • 2
    • 2
  • m

    Mihai Voicescu

    12/08/2021, 5:06 PM
    I have a
    NavHostController
    to navigate using the
    ComposeNavigator
    API. I need access to it in certain
    Compose
    functions. Is using the
    CompositionLocal
    API suitable for efficiently pass it around? Seems like they need access to the same reference and I couldn't find a function that already does that... Something like this
    val navController = rememberNavController()
    
        CompositionLocalProvider(LocalNavHostController provides navController) {
            NavHost(navController = navController, startDestination = navController.pathToMainScreen) {
                composable(navController.pathToMainScreen) { MainScreen() }
                composable(navController.pathToWifiScreen) { WiFiScreen() }
            }
        }
    m
    i
    a
    • 4
    • 11
  • b

    Brian G

    12/08/2021, 7:50 PM
    It seems Modifier.verticalScroll and LazyColumn contents are clickable even when scrolled off-screen. It's as if the contents are clipped only visually, but still on the screen (like View.INVISIBLE). Guessing that's a bug?
    • 1
    • 3
  • f

    Francois Morvillier

    12/08/2021, 7:55 PM
    Hi! I'm using androidx.navigation:navigation-compose:2.4.0-beta02. Every time I make a NavController.navigate call, I see graphic memory allocations of roughly 30Mb to 100Mb that never get reclaimed by the GC. This leads to Out of memory errors within 5mn of normal use of my app. Am I doing something wrong? If the solution is not clear, what can I do to investigate the issue?
    i
    • 2
    • 2
  • c

    Chris Johnson

    12/08/2021, 8:48 PM
    Hello! Is there a known way to chain detecting touch events? For example I'd like to
    detectTransformGestures
    and also
    detectTapGestures
    with double tap.
    m
    m
    +2
    • 5
    • 14
  • t

    tad

    12/09/2021, 12:22 AM
    Hi, I'd like to highlight this bug as I cannot figure out a workaround and it's generating support requests (I work on a banking app). The gist is that the "LG Keyboard" app doesn't show a decimal separator without
    TYPE_NUMBER_FLAG_DECIMAL
    set, which doesn't appear possible via
    TextInputService
    on Android. https://issuetracker.google.com/issues/209835363
    👀 1
    a
    • 2
    • 2
  • j

    joney

    12/09/2021, 8:47 AM
    The
    package androidx.compose.ui.res
    provides access to resources as follows (src):
    @Composable
    @ReadOnlyComposable
    private fun resources(): Resources {
        LocalConfiguration.current //<---- why?
        return LocalContext.current.resources
    }
    ☝️ I wonder why a call to
    LocalConfiguration.current
    is needed before accessing the
    resources
    field. Is this a pattern which I should follow for any values provided with local composition? 👇 So should I do this in my own code?
    @Composable
    @ReadOnlyComposable
    private fun myThing(): MyThing {
        LocalThings.current //<---- why?
        return LocalSomeThings.current.myThing
    }
    a
    t
    • 3
    • 9
  • y

    yschimke

    12/09/2021, 10:33 AM
    For a component like Accompanist HorizontalPager, the docs state
    Pages in both
    HorizontalPager
    and
    VerticalPager
    are lazily composed and laid-out as required by the layout. As the user scrolls through pages, any pages which are no longer required are removed from the content.
    Does this mean it is safe to use LaunchedEffect as a signal that the current page is just been shown? Or do they get created eagerly when user is contemplating a scroll/starting a swipe? Should pager state change events be used instead?
    c
    a
    • 3
    • 3
  • t

    Tomáš Hubálek

    12/09/2021, 12:37 PM
    Hi, I’m new to JetPack compose and I’m a bit confused with colors and themes in JetPack Compose. When I do:
    Text(
            text = "Something",
            style = MaterialTheme.typography.body1
    )
    then color is wrong when Android is set to dark mode. It is somehow connected to `Surface`/`Scaffold`but it is still not working for me. Why it is designed in so counterintuitive way? It looks like I have to specify colors in
    Typography
    (which is solution I feel is wrong as colors should be in ColorScheme IMHO)
    j
    • 2
    • 1
  • p

    Pavle Joksovic

    12/09/2021, 2:06 PM
    I have the following layout:
    Row {
        ComponentA()
        Column(modifier = Modifier.fillMaxSize()){
            ComponentB()
        }
    }
    how can I align the ComponentB to bottom right of the Column? I'm trying to achieve something from the image attached
    d
    n
    c
    • 4
    • 4
  • f

    Filip Wiesner

    12/09/2021, 2:17 PM
    I am not sure if this was reported by someone else (I couldn't find anything) but I have a problem with
    VisualTransformation
    in
    TextField
    (even with
    PasswordVisualTransformation
    ) Whenever
    VisualTransformation
    is involved the cursor disappears and cannot be moved by dragging. (video example)
    screen-20211209-151314~2.mp4
    z
    • 2
    • 6
  • c

    Chris Fillmore

    12/09/2021, 3:14 PM
    Are there any known issues with using bottom sheets for dynamic content and/or user (keyboard) input? For example: A bottom sheet containing a search bar and a list of items which is filtered based on the search.
    j
    • 2
    • 5
  • a

    Ashu

    12/09/2021, 3:41 PM
    Is LazyColumn really performance effective? My LazyColumn seems to be to janky and lagging on scroll. Is there any specific case for it or is it just bad in general? Also are there any best practices for combination of views in LazyColumn?
    b
    s
    • 3
    • 4
  • y

    YASAN

    12/09/2021, 4:56 PM
    I have a
    View
    variable inside a shared ViewModel which lives with in the app scope and not inside a specific route. I use this view inside one of my routes. My issue is that if the screen is rotated or the route is navigated to again from itself, loading the view throws an exception since the view is still attached to the previous layout parent. I know the fix for this is to have at least 2 instances of the view I need but the issue is that composable lifecycles work a bit weirdly and I cannot figure out exactly how and when I should tell the ViewModel to switch the used view so it wont throw an exception. More in 🧵
    c
    • 2
    • 8
  • t

    Tolriq

    12/09/2021, 5:53 PM
    Seeing how LazyColumn seems to fully recompose on item change is there any interest in having each item collect a secondary state in case some day lazycolumn change it's implementation or is the cost of the collectasstate in each items > recomposing the whole lazycolumn from a single collectasstate ?
    a
    • 2
    • 6
  • c

    Chris Fillmore

    12/09/2021, 5:53 PM
    I am using
    ModalBottomSheetLayout
    and
    BottomSheetNavigator
    and I’d like my bottom sheets to open into
    Expanded
    state. The
    HalfExpanded
    state doesn’t really suit my use case as there is often a lot of content in the sheet, and/or the keyboard is up. But, curiously,
    ModalBottomSheetState.expand()
    is
    internal
    and it’s not obvious to me how I could manipulate
    SwipeableState.anchors
    . Any advice? Thanks!
    j
    • 2
    • 5
  • b

    Brian Donovan

    12/09/2021, 6:13 PM
    Hey all, why is this coming up as a val?
    j
    k
    a
    • 4
    • 16
  • r

    Rob

    12/09/2021, 7:15 PM
    The intrinsic size of images loaded from a file is null which is causing a Image to have a height of 0. Is there a way to have the height of an
    Image
    match the aspect ratio of the image loaded?
    Untitled.kt
    • 1
    • 2
  • z

    zsperske

    12/09/2021, 7:25 PM
    Are
    firstBaselineToTopHeight
     &
    lastBaselineToBottomHeight
    (TextView attributes) available in Compose?
    l
    t
    c
    • 4
    • 3
  • b

    brabo-hi

    12/09/2021, 11:20 PM
    Hi All, on material3, there is no option to dock floatingActionButton to the bottomBar, doesn’t it mean it is no longer recommended to do so ? Also on the new 
    androidx.compose.material3:material3:1.0.0-alpha02
      
    scaffoldState
      has been removed. Does it mean in the future we will no longer be able to launch a Snackbar and link it’s state to the Scaffold?
    c
    • 2
    • 2
  • d

    darkmoon_uk

    12/10/2021, 12:52 AM
    Do folk have any smart ways of discovering what causes a recomposition? My ideal would be some log that says 'Because <name> state changed at <file:line>'? My use case is debugging 'jank' in
    AnimatedContent
    transitions because multiple recompositions are firing where conceptually there should be only one. Carefully tracing the code for state changes is a given, just wondering if people can share any smart breakpoints/profiling tricks they're employing?
    d
    • 2
    • 13
  • s

    star_zero

    12/10/2021, 1:53 AM
    Which is the better own dialog component in Jetpack Compose?
    z
    o
    • 3
    • 8
  • p

    Peng Wang

    12/10/2021, 3:43 AM
    @Composable
    @Deprecated("Example with bug")
    fun ListWithBug(myList: List<String>) {
        var items = 0
    
        Row(horizontalArrangement = Arrangement.SpaceBetween) {
            Column {
                for (item in myList) {
                    Text("Item: $item")
                    items++ // Avoid! Side-effect of the column recomposing.
                }
            }
            Text("Count: $items")
        }
    }
    I don't know why this code has thread-safe problem, can anyone explain ? https://developer.android.google.cn/jetpack/compose/mental-model#parallel
    a
    z
    s
    • 4
    • 16
  • z

    Zoltan Demant

    12/10/2021, 6:37 AM
    How can I automatically reduce fontSize if the text overflows? Im using onTextLayout and didOverflowWidth, but its always false even though my text clearly overflows!
    s
    • 2
    • 4
  • o

    oday

    12/10/2021, 7:03 AM
    any reason why I can’t find the
    weight
    Modifier? just goes unresolved, no hint to import or anything, using Compose
    1.0.5
    z
    t
    m
    • 4
    • 9
  • i

    iamthevoid

    12/10/2021, 8:40 AM
    How to reach same behavior in Compose like MATCH_PARENT in View Framework behave? modifier
    fillMax...
    looks pretty the same, but when it applied to child of container, that doesn’t have exact size, then child stretch the parent when i used view framework i can did like
    parent(wrap_content) {
       child(match_parent) // 1
       child(exact_size) // 2
    }
    and size of
    1
    was always the same as size of
    2
    . And when size of
    2
    changes size of
    1
    changes as well. Can i do the same in Compose?
    a
    t
    j
    • 4
    • 7
  • f

    fvink

    12/10/2021, 11:15 AM
    Is there a way to make a LazyColumn scrollable in preview? currently my preview content is larger than the preview size and there’s no way to scroll it.
    s
    y
    +2
    • 5
    • 5
  • j

    jannis

    12/10/2021, 11:25 AM
    I'm using a
    AnimatedNavHost
    from the Accompanist library (+latest Compose beta). Even if I disable all animations, e.g.:
    AnimatedNavHost(
        ...
        enterTransition = { EnterTransition.None },
        exitTransition = { ExitTransition.None },
        popEnterTransition = { EnterTransition.None },
        popExitTransition = { ExitTransition.None },
    ) {
    I see an expand transition when I open a new screen. Can I disable that somehow? I don't even see where this might coming from 😅
    a
    a
    k
    • 4
    • 8
Powered by Linen
Title
j

jannis

12/10/2021, 11:25 AM
I'm using a
AnimatedNavHost
from the Accompanist library (+latest Compose beta). Even if I disable all animations, e.g.:
AnimatedNavHost(
    ...
    enterTransition = { EnterTransition.None },
    exitTransition = { ExitTransition.None },
    popEnterTransition = { EnterTransition.None },
    popExitTransition = { ExitTransition.None },
) {
I see an expand transition when I open a new screen. Can I disable that somehow? I don't even see where this might coming from 😅
a

Alex

12/10/2021, 11:30 AM
afaik routes can also define their own animations, maybe they set a default value there?
j

jannis

12/10/2021, 11:58 AM
I have a nested navigation. I've removed the transition everywhere.
Hmm. When I do a simple sample project I don't get the animation 😅 seems I have to have a second look
😬 1
a

allan.conda

12/10/2021, 8:39 PM
You can try to reduce your code into a minimal state, then Undo until the issue occurs. Maybe there's a Crossfade function on the content?
k

Kimon

01/30/2022, 12:08 PM
I have the same issue. @jannis did you find a solution to this?
j

jannis

01/31/2022, 7:58 AM
Yes. The problem was that the initial Composable of the target destination had a size of 0, instead of filling the whole screen
🙌 1
k

Kimon

01/31/2022, 8:30 AM
Thank you for your answer. I will check it out 🙂
That was the problem for me also. Thank you for saving me from extra hours of troubleshooting 🙂
👍 1
View count: 5