iroyo
12/15/2021, 5:00 PMdata class CustomColors
and then a staticCompositionLocalOf
but... does it make sense to omit all of this if we use an object instead?Anthony
12/15/2021, 5:26 PMCompositionLocalProvider
to provide alpha and text values, should the approach be different when using an annotated string? When I use a simple Text composable, the alpha and color is applied, but a annotated string inside a clickable text does not reflect these changes.dewildte
12/15/2021, 7:01 PMBottomSheetDialogFragment
and it’s layout has a ComposeView
in it. When trying to show the sheet I get this:
java.lang.IllegalStateException: ViewTreeLifecycleOwner not found
after the framework calls:
androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareViewTreeRecomposer(WindowRecomposer.android.kt:244)
Anybody run into this before?colintheshots
12/15/2021, 8:51 PModay
12/15/2021, 8:53 PMconstrainAs
and top
https://developer.android.com/codelabs/jetpack-compose-layouts?continue=https%3A%2F%2Fd[…]developer.android.com%2Fcodelabs%2Fjetpack-compose-layouts
even though I’ve included the library needed for ConstraintLayout and I’m using compose 1.0.5Yves Kalume
12/15/2021, 9:09 PMnschulzke
12/15/2021, 10:47 PMjava.lang.IllegalStateException: Symbol for kotlin.collections/mutableMapOf|-4813910536206556932[0] is unbound
at org.jetbrains.kotlin.ir.symbols.impl.IrBindablePublicSymbolBase.getOwner(IrPublicSymbolBase.kt:52)
at org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionPublicSymbolImpl.getOwner(IrPublicSymbolBase.kt:74)
at androidx.compose.compiler.plugins.kotlin.lower.LiveLiteralTransformer.visitCall(LiveLiteralTransformer.kt:663)
...
Colton Idle
12/15/2021, 11:37 PMtasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += listOf(
"-Xallow-jvm-ir-dependencies",
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true"
)
}
}
Luis Daivid
12/16/2021, 2:36 AMRamesh
12/16/2021, 5:13 AMrkeazor
12/16/2021, 6:10 AMZoltan Demant
12/16/2021, 7:45 AMText
composable misalign its text like this in some situations (seemingly, only on a Huawei P30 Pro)?Michal Klimczak
12/16/2021, 8:14 AMJavier
12/16/2021, 10:45 AM// Doesn't work, it keeps the size over the time.
SomeComponent(
shape = RoundedCornerShape(if (someState) 8.dp else 30.dp),
)
// Work, size is changing
SomeComponent(
shape = if (someState) RoundedCornerShape(8.dp) else RoundedCornerShape(30.dp),
)
nglauber
12/16/2021, 1:57 PMLazyColumn
scroll state after navigate to a different screen? I’m getting a strange behavior…
val listState = rememberLazyListState()
val reportList by viewModel.reportList.flowInLifecycle()
.collectAsState(initial = emptyList())
The code above is in ScreenA
, from this screen I open ScreenB
. When I return to ScreenA
, the reportsList
becomes empty for 1 composition, so the listState
moves to position 0.yschimke
12/16/2021, 4:46 PMdimsuz
12/16/2021, 5:39 PMfun main() {
var state by mutableStateOf(value = "30")
application {
Window {
Button(onClick = { state = "1"; state = "2"}) {
println("got $state")
Text(state)
}
}
}
}
Debugger shows that shapshot system sees all values, but recompositionRunner
never receives the "1" value. Are there some optimizations in Snapshot.apply
method maybe? What should one do to receive all state updates (or is this impossible/wrong)?Mohammad Jahidul Islam
12/16/2021, 5:50 PMBrian Donovan
12/16/2021, 6:22 PMNick Anthony
12/16/2021, 7:46 PM1.6.10
support, we shipped Compose Compiler 1.1.0-rc02
with official support for Kotlin 1.6.10
(see https://developer.android.com/jetpack/androidx/releases/compose-compiler#1.1.0-rc02). Additionally, we also started publishing a table mapping the Compose Compiler version to it's compatible Kotlin version. (https://developer.android.com/jetpack/androidx/releases/compose-kotlin)Marcello Galhardo
12/16/2021, 9:09 PMSideEffect
it says:
To share Compose state with objects not managed by compose, use theIf acomposable, as it’s invoked on every successful recomposition.SideEffect
SideEffect
is called on “each recomposition”, what is the difference between the two codes:
@Composable
fun sample(user: User) {
// 1. With Side Effect, called each successful recomposition.
SideEffect { analytics.setUserProperty("userType", user.userType) }
// 2. No SideEffect, called each recomposition.
analytics.setUserProperty("userType", user.userType)
}
My understand is that a SideEffect
would not be triggered if a recomposition happens (similar to LaunchedEffect
and how it works with the keys) but based in the docs I think I’m missing something…Colton Idle
12/16/2021, 10:27 PM// composable
val currentOnUserLogIn by rememberUpdatedState(onUserLogIn)
LaunchedEffect(viewModel.uiState) {
if (viewModel.uiState.isUserLoggedIn) {
currentOnUserLogIn()
}
}
I have a bunch of questions
1. I don't understand the use of val currentOnUserLogIn by rememberUpdatedState(onUserLogIn)
. Why doesn't this code sample just call onUserLogIn
directly?
2. What goes into LaunchedEffect arg exactly? It seems like its easy to mess up what exactly goes in there and therefore shoot yourself in the foot. I can expand on this if that didn't make sense.
3. Why can't I just pass the ref of onUserLogIn event into the ViewModel and onSuccess of a login network call it would just call onUserLogIn in the VM itself?loloof64
12/16/2021, 10:41 PM@Composable
: GamePage
, which is using a native library. But this native library must be stopped when not needed any more:
@Composable
fun GamePage() {
val myLib = MyLib()
...
myLib.stop()
}
So, is there a way to ?
1. Build a new MyLib instance at each recomposition
2. But also stop it before the next recomposition
3. Can I wait some milliseconds before "commiting" the next recomposition ?Benjamin Deroche
12/17/2021, 10:36 AMZoltan Demant
12/17/2021, 1:25 PMTextField
shrinks its size inside a Column
, other composables under it will jump up. Normally Id use Modifier.weight(1f)
so that they stick to the bottom, however that doesnt work inside a AlertDialog
without causing it to extend across the entire screen height. Is there another way?Nat Strangerweather
12/17/2021, 4:06 PMjeff
12/17/2021, 4:24 PMInput
(i.e. not a MutableState), and all of the sub-composables are based on fields from Input
:
Can any of the sub-composables inside it be recomposed without recomposing the parent? If so I'd love to see an example, because I can't seem to concoct one.David Odari
12/17/2021, 5:16 PM@PreviewParameter
is used despite creating providers as specified here ?Shreyas Patil
12/18/2021, 6:49 AMTextField
in a Jetpack Compose, I came across a case where I have to modify input typed in the field. For example, adding a comma after entering 3 characters.
This is how I made it.
@Composable
fun TFDemo() {
var fieldValue by remember { mutableStateOf(TextFieldValue("")) }
TextField(
value = fieldValue,
onValueChange = {
val newMessage = it.text.let { text -> if (text.length == 3) "$text," else text }
fieldValue = it.copy(newMessage, selection = TextRange(newMessage.length))
},
keyboardOptions = KeyboardOptions(autoCorrect = false),
)
}
But after running it, I realized that after the comma is added, keyboard view changed back to alphabets from numbers/symbols which should not be the case. See video output below for clarity
As you can see in the below video when I typed "111" comma was appended and suddenly keyboard's numeric view changed to alphabets again.
Stackoverflow: https://stackoverflow.com/questions/70401519/android-jetpack-compose-keyboard-changing-from-numeric-to-alphabets-after-modifste
12/18/2021, 3:09 PMste
12/18/2021, 3:09 PMnilTheDev
12/18/2021, 7:19 PMColton Idle
12/18/2021, 9:10 PMefemoney
12/19/2021, 10:57 AMColton Idle
12/19/2021, 5:20 PMKazem Moridi
12/20/2021, 6:04 AMMichal Klimczak
12/20/2021, 7:42 AMste
12/21/2021, 9:17 AMColton Idle
12/21/2021, 3:29 PMste
12/21/2021, 5:12 PMCLOVIS
01/03/2022, 6:26 AM