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
  • t

    Tuba Kesten

    01/28/2021, 6:26 PM
    LoginViewModel() {
        private val _sessionUser = MutableLiveData<SessionUser>()
        val sessionUser: LiveData<SessionUser>
            get() = _sessionUser
        fun changeSessionUserValue() {
            _sessionUser.value = ....
        }
    }
    @composable
    OuterComposable(){
        val currentSessionUser: SessionUser? by loginViewModel.sessionUser.observeAsState()
        Timber.d("Heyyooo!")
        NavHost(...) {
            ....,
            composable(route) { InnerComposable(loginViewModel) }
        }
        ....
    }
    @composable
    InnerComposable(loginViewModel) {
        ....
        NavHost(...) {
            ....,
            composable(rt) { InnerInnerComposable(loginViewModel) }
        }
    }
    @composable
    InnerInnerComposable(loginViewModel) {
        Button(onClick = loginViewModel.changeSessionUserValue())
    }
    Hi guys, I have a question related to observing mutable live data. When the activity created, outerComposable is called and 
    "Heyyooo!"
       is logged. After, the user clicks to the button in InnerInnerComposable, changeSessionUserValue is called. However the observed sessionUser in OuterComposable is not triggered so that 
    Heyyooo!
     is not logged on screen again after button click. Any idea why I can't trigger 
    observeAsState
     ? Thanks🤗
    l
    • 2
    • 1
  • r

    rsktash

    01/28/2021, 7:22 PM
    How to call suspend functions?
    l
    d
    • 3
    • 5
  • a

    alorma

    01/28/2021, 7:48 PM
    • IS anyone else getting:
    Duplicate class androidx.compose.animation.AlignmentBasedSizeAnimation found in modules animation-1.0.0-alpha11-runtime (androidx.compose.animation:animation:1.0.0-alpha11) and animation-debug-runtime (org.jetbrains.compose.animation:animation-android-debug:0.3.0-build141)
    ????
    j
    • 2
    • 18
  • r

    rsktash

    01/28/2021, 8:28 PM
    I’m having this error after updating IncompatibleClassChangeError: Found interface androidx.compose.runtime.Composer, but class was expected (declaration of ‘androidx.compose.runtime.Composer’ appears in /data/app/uz.apk
    a
    • 2
    • 5
  • d

    Daniele B

    01/28/2021, 9:37 PM
    After upgrading from Alpha 9 to Alpha 11, I got these two issues. Any idea what’s the new syntax?
    z
    n
    a
    • 4
    • 7
  • d

    Doris Liu

    01/29/2021, 12:57 AM
    FYI, the
    transitionDefinition
    based transitions have been deprecated in alpha 11. The replacements are: updateTransition and rememberInfiniteTransition for the finite and infinite use cases, respectively. I know it's a large amount of API change. 😅 Hopefully, the new API is more straightforward to use. If you have any questions about them, or any issue with your migration, please let me know. I'm happy to help. 🙂
    🙏🏼 1
    🎉 12
    😒uspend: 1
    r
    a
    +3
    • 6
    • 12
  • j

    Jason Ankers

    01/29/2021, 3:52 AM
    How can we resize vectors now that ImageVector is no longer a data class in
    1.0.0-alpha11
    ? Previously was doing:
    vectorResource(R.drawable.ic_target).copy(defaultHeight = 18.dp, defaultWidth = 18.dp)
    👀 8
    a
    s
    n
    • 4
    • 38
  • a

    Alexa_Gal

    01/29/2021, 4:04 AM
    any one having this issue after updating to alpha11
    org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl@1240ed89: No such type argument slot: 1
    ?
    ✅ 1
    j
    n
    s
    • 4
    • 4
  • a

    Arkadii Ivanov

    01/29/2021, 11:28 AM
    Hello! Am I right that the the following legacy calls are equivalent?
    onCommit(Unit) {}
    and
    onActive {}
    .
    a
    • 2
    • 1
  • m

    Marko Novakovic

    01/29/2021, 1:14 PM
    ViewModel
    as it is, for surviving configuration change isn’t really needed in
    Compose
    . Right?
    Compose
    has it’s own
    by saveInstanceState
    . do we still use
    ViewModel
    as we have been using it until now?
    d
    n
    +2
    • 5
    • 6
  • d

    Daniele B

    01/29/2021, 1:37 PM
    I am replacing 
    ScrollableColumn
     (which is now deprecated) with
    Column(modifier = Modifier.verticalScroll(rememberScrollState())
    but 
    Column
     doesn’t have the 
    contentPadding
     parameter, so when using 
    Scaffold
     with a 
    BottomBar
     , the bottom part of the column gets covered by the bottombar. Any solution?
    👍 2
    a
    a
    c
    • 4
    • 14
  • j

    julioromano

    01/29/2021, 2:09 PM
    👋 On a widget with a
    BasicTextField
    and an
    IconButton
    , I’d like to give focus to the text field (and therefore have the on screen keyboard appear) at the press of the button. Which API should I use?
    a
    z
    • 3
    • 16
  • v

    Vitor Prado

    01/29/2021, 5:41 PM
    hey guys.. is it correct to create a “previewTheme” to avoid unnecessary providers when previewing composables?
    j
    • 2
    • 4
  • a

    Alexa_Gal

    01/29/2021, 6:33 PM
    Hi guys, not sure if this belong to this channel but ill try. im using Compose + StateFlow and i have a function that will trigger an event (i’ll call it
    authMethod
    )
    viewModel.authMethod.onEach {
                Log.e("i'm here", "yes im here ${it}")
            }.collect()
    this will be trigger the first time and every time after i change the value on the viewModel. my issue is that when i push new view (using
    Navigation alpha06
    ) and i pop back the
    onEach
    will be triggered again. How could i only tell
    authMethod
    to be triggered only on changes and not every-time the compose is rendering ?🌈 With liveData i had the observable that only triggers on changes, but i can not find the equivalent on StateFlow :/
    z
    j
    +2
    • 5
    • 19
  • j

    Jordi Saumell

    01/29/2021, 6:36 PM
    How do I force recomposition without passing a parameter if I won’t use it? Context: I am changing the locale of the app and I handle config changes so that the activity is not recreated. Therefore. I need a way to force recomposition of the UI to update the resources… As I haven’t found a way of observing the AmbientConfiguration, I observe a state variable with the selected language. Currently I pass that variable to the composable function that is at the root of the UI to trigger recomposition. But it is not used, which feels wrong.
    z
    c
    • 3
    • 15
  • z

    Zach Klippenstein (he/him) [MOD]

    01/29/2021, 7:20 PM
    I noticed a lot of “removed
    data class
    from {list of types}” in alpha11 – what’s the reason for this purge? I know data classes are bad for library binary compatibility, is that it?
    j
    l
    d
    • 4
    • 14
  • n

    Neal Sanche

    01/29/2021, 7:36 PM
    I've been trying, probably for too long, to use @cb Insets Accompanist library to show a
    BottomNavigation
    with a height that also includes the navigation bar height, so that the
    BottomNavigation
    paints all the way to the bottom of the screen. I have tried all sorts of things, and just end up with a space underneath the bottom nav. I sort of want this effect without having to resort to making a column with a spacer at the bottom. Here's the code I have so far within my
    Scaffold
    bottomBar = {
                Column(Modifier.background(MaterialTheme.colors.primary)) {
                    BottomNavigation(
                        elevation = 0.dp,
                        backgroundColor = MaterialTheme.colors.primary,
                        contentColor = contentColorFor(MaterialTheme.colors.primary),
                    ) {
                        bottomNavItems.forEach { screen ->
                            val navBackStackEntry by navController.currentBackStackEntryAsState()
                            val currentRoute =
                                navBackStackEntry?.arguments?.getString(KEY_ROUTE)
                                    ?: Screen.Profile.route
    
                            BottomNavigationItem(
                                icon = { Icon(imageVector = screen.icon, contentDescription = null) },
                                label = { Text(stringResource(screen.resourceId)) },
                                selected = currentRoute == screen.route,
                                onClick = {
                                    navController.navigate(screen.route) {
                                        popUpTo = navController.graph.startDestination
                                        launchSingleTop = true
                                    }
                                }
                            )
                        }
                    }
                    Spacer(Modifier.navigationBarsHeight())
                }
            }
    c
    • 2
    • 2
  • t

    Tony Kazanjian

    01/29/2021, 9:46 PM
    Hey all. So before the alpha 11 update, I was using a 
    ScrollableColumn
     to display a list of a set number of items, i.e.:
    ScrollableColumn(modifier.padding(bottom = 56.dp)) {
        collections.forEach {
            ProductCollection(collection = it)
        }
    }
    The 
    ProductCollection
     essentially contains a composable that is a 
    LazyRow
     for showing 
    LazyPagingItems
    @Composable
    fun ProductItemListWithId(
            collectionId: Int,
            modifier: Modifier = Modifier,
            content: @Composable LazyItemScope.(ProductItem) -> Unit){
        val viewModel: ProductListViewModel = getViewModel()
    
        val products = viewModel.getPagingFlowForCollection(collectionId).collectAsLazyPagingItems()
        LazyRow{
            items(products){
                product -> product?.let { content(it) }
            }
        }
    }
    ScrollableColumn
    has been deprecated now, but it's only the row items that I want lazy loaded. Trying to use a
    LazyColumn
    a la :
    LazyColumn(
            modifier = modifier.padding(bottom = 56.dp)) {
            item {
                collections.forEach {
                    ProductCollection(it)
                }
            }
        }
    Results in the row items not always getting loaded since they are coming from a
    Flow<PagingData>
    that is fired lazily. What can I do to work around this, or to just simply make a normal
    Column
    scrollable again in Alpha 11?
    • 1
    • 1
  • j

    Jordi Saumell

    01/29/2021, 9:55 PM
    I’m having trouble with Ripples on Alpha 11, with clickable no longer having an indication 😅 I read we are supposed to use the AmbientRippleTheme but I do not know how (thread)
    r
    a
    +2
    • 5
    • 10
  • j

    Jan Skrasek

    01/29/2021, 11:45 PM
    My function has an argument
    error: @Composable (() -> Unit)? = null
    i.e. a rendering lambda of the error or a null. I want to animate that rendering, so I need to postpone "nulling" the error until the hide animation finishes. How can I remember the composable result?
    Box(
        modifier = Modifier
            .alpha(errorAlpha.value)
    ) {
        if (error != null) {
            error()
        }
    }
    • 1
    • 1
  • a

    Alexa_Gal

    01/30/2021, 1:55 AM
    is there any way to run a function that will be executed only in the first composition . Compose A compose and prints a
    Hello word
    Compose A navigates to Component B Component B popsBack to Component A Component A should not print again “Hello word” since this was already on the stack
    @Composable
    fun ComponentA() {
    
        LaunchedEffect(Unit) {
            Log.e("=======", "I need to run only once and not when other Component PopsBack")
        }
    
        Button("Continue", onClick = {
            navController.navigate("ComponentB")
        })
    
    }
    j
    a
    • 3
    • 5
  • c

    carbaj0

    01/30/2021, 6:52 AM
    hi, 👋 😀 why you avoided put a null default in the content description field of Icon, Image ... ? I think that if you want that a field was mandatory, at least it shouldn´t be nullable
    fun Icon(
        imageVector: ImageVector,
        contentDescription: String? = null,
        modifier: Modifier = Modifier,
        tint: Color = AmbientContentColor.current.copy(alpha = AmbientContentAlpha.current)
    ) { ... }
    c
    • 2
    • 2
  • m

    Manuel Lorenzo

    01/30/2021, 9:48 AM
    do you guys have a scaffold with top bar, bottom bar and content for each screen? or do you have the same top/bottom bar with different states and the body content is modified for each screen?
    f
    i
    • 3
    • 6
  • r

    Rafs

    01/30/2021, 10:56 AM
    What is the equivalent of
    fitSystemWindows
    in compose
    m
    • 2
    • 1
  • s

    Shakil Karim

    01/30/2021, 11:48 AM
    How can i do hide/Show Composable instead of if (someCondition) { ComposableA() } else { ComposableB() } Because using if-else I'm getting flicker when changing screens, Which is what I want to avoid.
    a
    j
    • 3
    • 5
  • d

    Denis

    01/30/2021, 12:18 PM
    How do you use
    TextDelegate
    ? There was a similar question before [1]. I want to render some text matching a particular width. I used code from [2], but can't make it work.
    @Preview
    @Composable
    fun TextAutoSize() {
        class TestFontResourceLoader(val context: Context) : Font.ResourceLoader {
            override fun load(font: Font): android.graphics.Typeface {
                return when (font) {
                    is ResourceFont -> ResourcesCompat.getFont(context, font.resId)!!
                    else -> throw IllegalArgumentException("Unknown font type: $font")
                }
            }
        }
    
        val textDelegate = TextDelegate(
            text = AnnotatedString("Hello, World"),
            style = TextStyle.Default,
            maxLines = 1,
            density = Density(density = 1f),
            resourceLoader = TestFontResourceLoader(AmbientContext.current),
        )
        val layoutResult = textDelegate.layout(Constraints.fixedWidth(1000), LayoutDirection.Ltr)
    
        Canvas(Modifier.fillMaxWidth().height(50.dp)) { // CanvasScope
            drawIntoCanvas {
                TextDelegate.paint(canvas = it, layoutResult)
            }
        }
    }
    [1] https://kotlinlang.slack.com/archives/CJLTWPH7S/p1611055679272900 [2] https://github.com/androidx/androidx/blob/androidx-main/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextFieldDelegateIntegrationTest.kt
    v
    • 2
    • 2
  • o

    orangy

    01/30/2021, 2:30 PM
    Does anyone have ready-made spline shape?
    j
    n
    • 3
    • 3
  • a

    Ayomide

    01/30/2021, 2:50 PM
    Hi! I'm trying to model a sort of directory explorer UI with compose. I think I've got the underlying data structure right - however I want to do certain actions based on the name of the file that was opened. But I'm not sure how to get the "state" from a composable (like what it's current text is if it's a button) from outside the composable. For example in the screenshot below (haven't figured out how to tab them properly yet 😅 ) I have
    File
    composables that are created as "children" of a
    FilePane
    composable. Which means I have to hoist the same
    onClick
    callback to all of them. But how would I get a name like
    Hello.java
    from the
    onClick
    function that is given to all the buttons in the image when the
    Hello.java
    button is clicked? I feel like I am modelling this wrong, since composables should largely be stateless, except for the top level composable
    j
    • 2
    • 3
  • k

    Kshitij Patil

    01/30/2021, 4:40 PM
    Thanks a lot for alpha11 release. It solved all my keyboard related issues 🥳🥳 Can’t wait to see what’s cooking up next. Just tried out this snippet to pre-focus a TextField on First load and it worked like charm. Let me know if anything is wrong doing it this way
    val fieldFocus = remember { FocusRequester() }
    LaunchedEffect(key1 = Unit) {
        addressFocus.requestFocus()
    }
    :kotlin-intensifies: 1
    z
    g
    +6
    • 9
    • 25
  • n

    Nat Strangerweather

    01/30/2021, 7:21 PM
    I am finally starting with Navigation but I am stuck with a basic problem:
    Scaffold(
                scaffoldState = scaffoldState,
                drawerContent = {
                    HomePageDrawer()
                },
    For HomePageDrawer() I get : "No value passed for parameter 'navController'". What am I supposed to put for parameter navController? Whatever I try gives me a nullpointer... Basically I have some items in my drawer and I want to navigate to other screens from them...
    i
    n
    • 3
    • 12
Powered by Linen
Title
n

Nat Strangerweather

01/30/2021, 7:21 PM
I am finally starting with Navigation but I am stuck with a basic problem:
Scaffold(
            scaffoldState = scaffoldState,
            drawerContent = {
                HomePageDrawer()
            },
For HomePageDrawer() I get : "No value passed for parameter 'navController'". What am I supposed to put for parameter navController? Whatever I try gives me a nullpointer... Basically I have some items in my drawer and I want to navigate to other screens from them...
i

Ian Lake

01/30/2021, 7:50 PM
The Getting Started part of the guide (https://developer.android.com/jetpack/compose/navigation#getting-started) states that you should be using
rememberNavController()
outside of your
Scaffold
I.e., in a place where every Composable that needs to access it can access it
n

Nat Strangerweather

01/30/2021, 7:58 PM
I'm using it in my navigation composable:
@Composable
fun ApplicationNavigation() {
    val navController = rememberNavController()
    androidx.navigation.compose.NavHost(
        navController = navController,
        startDestination = "homepage"
    ) {
        composable("homepage") {
            HomePage()
        }
        composable("drawer"){
            HomePageDrawer(navController)
        }
        composable("placeholder"){
            PlaceHolder()
        }
    }
But how can I refer to it in my HomePage Scaffold? I'm a bit confused.
Hmm, I'll try to do what you suggested and as the doc indicates, thanks.
i

Ian Lake

01/30/2021, 8:22 PM
Just pass in
navController
👍 1
n

Nikola Drljaca

01/31/2021, 11:13 AM
You could also consider passing a lambda instead of passing the
navController
, that way you can keep all navigation related code in one place and not pass the
navController
around
n

Nat Strangerweather

01/31/2021, 1:29 PM
@Nikola Drljaca Thanks for this, I'm interested in your idea. Would you be able to show me how it would look, if you have the time? Maybe with my example above?
n

Nikola Drljaca

01/31/2021, 2:42 PM
Well, here is a quick example of something thats similar to what I use. For your example, I think you can pass the lambda down your composable tree to wherever you need to call
navigate()
. Maybe the parent of the scaffold can have a lambda and pass it to the
HomePageDrawer()
. Anyway, here's a gist https://gist.github.com/nikolaDrljaca/06013137c325638ac6b71ca3ac76c681
Of course, this might not be the "proper" way to do it, but to me it seemed cleaner than passing the
navController
everywhere.
n

Nat Strangerweather

01/31/2021, 3:29 PM
Thanks for this, really appreciate it
i

Ian Lake

01/31/2021, 4:07 PM
Yep, that's actually the recommended practice to make your composables separately testable (from a bit farther down that exact same page I linked earlier): https://developer.android.com/jetpack/compose/navigation#testing
n

Nat Strangerweather

01/31/2021, 4:14 PM
Oh excellent, thanks, I really need to start reading the doc more carefully! 😉
View count: 1