Pavle Joksovic
05/20/2022, 8:32 AMGuilherme Delgado
05/20/2022, 1:45 PMverticalArrangement = Arrangement.SpaceBetween
and if it’s Surface
parent defines .fillMaxSize()
, the Column’s height is not respected. More in threadallan.conda
05/20/2022, 1:46 PMVaios Tsitsonis
05/20/2022, 2:03 PMagrosner
05/20/2022, 3:01 PMmanju reddy
05/20/2022, 4:57 PMmertceyhan
05/20/2022, 5:22 PMNat Strangerweather
05/20/2022, 8:20 PMJi Sungbin
05/21/2022, 8:00 AMJi Sungbin
05/21/2022, 8:01 PMinvalidateStack
, and if this stack is not empty, it is popped from this stack and returned from endRestartGroup()
. Recomposition is performed through the returned RecomposeScope
. Right? However, if there is no invalidation during the composition process, null is returned, and if invalidation is requested later, how does endRestartGroup()
detect this and recompose again?
If look at the implementation of endRestartGroup()
, there is no code to track invalidations. Only request pop once.
val scope = if (invalidateStack.isNotEmpty()) invalidateStack.pop() else null // RecomposeScopeImpl?
EDIT: I found some clues. Suspend until invalidation is added through awaitWorkAvailable()
in Recomposer.runRecomposeAndApplyChanges()
. If there is a waiting task(hasSchedulingWork
), it immediately resumes Continuation
and proceeds to recompose. Otherwise, it maintains the suspend state. The maintained suspend(CancellableCoroutine
) is resumed when the operation is completed through the effectJob
, but as I traced the places where the effectJob
is used, there are only rememberCoroutineScope()
and LaunchedEffect
. Where will this suspend resume? I think it’s time to record invalidation, but it wasn’t. They are recorded regardless of Job
.Eko Prasetyo
05/22/2022, 4:31 AM_state.value = _state.value.copy(...)
. Does something like this should be avoided or affecting performance?shahroz
05/22/2022, 8:51 AMUli Bubenheimer
05/22/2022, 8:10 PMxxfast
05/23/2022, 12:53 AM@Composable
in the 🧵Zoltan Demant
05/23/2022, 5:46 AMAlexander Stark
05/23/2022, 6:10 AMRow(
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(
modifier = Modifier
.weight(1f)
.widthIn(min = 200.dp),
textAlign = TextAlign.Start,
text = "Left side side side side side side side",
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
Text(
textAlign = TextAlign.End,
text = "Right right right right right right",
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
In best case I would be able to tell the right text to take only 60% but if the 60% is not required take less.
With weight(0.6f)
it's a fixed space of 60% even if it's not requiredPeng Wang
05/23/2022, 7:19 AMval state = mutableListOf(0f)
@Preview
@Composable
fun test() {
Box {
Button(onClick = {
state[0] += 100f
}) {
Text(" > ")
}
Canvas(Modifier.fillMaxSize()) {
drawCircle(color = Color.Red, center = Offset(state[0], 500f), radius = 200f)
}
}
}
fengdai
05/23/2022, 7:51 AMMedia
composable reacts to parameters changes:RE
05/23/2022, 9:14 AMSam Stone
05/23/2022, 3:00 PMJoseph Hawkes-Cates
05/23/2022, 4:44 PMJi Sungbin
05/23/2022, 4:49 PM@Composable inline fun <T : Any, reified E : Applier<*>> ReusableComposeNode(
noinline factory: () -> T,
update: @DisallowComposableCalls Updater<T>.() -> Unit
) {
if (currentComposer.applier !is E) invalidApplier()
currentComposer.startReusableNode()
if (currentComposer.inserting) {
currentComposer.createNode { factory() }
} else {
currentComposer.useNode()
}
currentComposer.disableReusing()
Updater<T>(currentComposer).update()
currentComposer.enableReusing()
currentComposer.endNode()
}
I noticed with this code that the only difference between ReusableComposeNode and ComposeNode is the way the groups are created. The KDoc of startReusableNode(), which is the group creation method used in ReusableComposeNode, is written as follows.
Start a group that tracks a the code that will create or update a node
that is generated as part of the tree implied by the composition. A
reusable node can be reused in a reusable group even if the group key
is changed.I don’t know what reused means here. Does this mean that the node is reused as measured? (normal nodes will start with the measure phase. but does the reused node skip the measured phase?)
Peter Mandeljc
05/23/2022, 5:39 PMMarcin Wisniowski
05/23/2022, 7:44 PMMarcin Wisniowski
05/23/2022, 9:58 PM1.1.0-beta03
, Kotlin 1.5.31
) to (Compose Compiler 1.1.0-beta04
, Kotlin 1.6.0
) I am having a weird issue where after navigating back to a Fragment the Fragment's UI (View-based, not Compose) is no longer responsive. Single-activity app with navigation component, issue appears with any View-based Fragment after navigating back to it (fine on Compose Fragments). I am having a hard time debugging this, or seeing why would updating the Compose Compiler affect non-Compose Fragments, did anyone see a similar issue?Mini
05/24/2022, 7:35 AMColton Idle
05/24/2022, 8:03 AMvar list = mutableStateListOf<Location>()
but my map never updates until I reload that page.
I believe I'm doing everything correclty, because if I comment out my MapView code and replace it with a Column + forEach then all of my items show when the network call completes. Is there some sort of thing you need to hook into with AndroidView + mapView to have it respond to mutableState?alaershov
05/24/2022, 8:43 AMTextField
? Or more specifically: what is the most reasonable way to create a PIN code input widget with input from software keyboard? I'm used to hacks with invisible EditTexts
in View system, but I'd like very much to avoid this stuff in Compose and do it the right way.
Any recommendations?Aaron Waller
05/24/2022, 9:05 AMJoseph Hawkes-Cates
05/24/2022, 2:17 PMJoseph Hawkes-Cates
05/24/2022, 2:17 PMFilip Wiesner
05/24/2022, 2:20 PMwrapContentWidth
modifier to ignore the Columns width constraints
Allow the content to measure at its desired width without regard for the incoming measurement minimum width constraint, and, if unbounded is true, also without regard for the incoming measurement maximum width constraint.
Joseph Hawkes-Cates
05/24/2022, 2:20 PM