fengdai
05/07/2022, 9:49 AMvar refreshing by remember { mutableStateOf(false) }
LaunchedEffect(refreshing) {
if (refreshing) {
delay(2000)
refreshing = false
}
}
SwipeRefresh(
state = rememberSwipeRefreshState(isRefreshing = refreshing),
onRefresh = { refreshing = true },
) { ... }
2. Can’t enter refreshing state:
val state = rememberSwipeRefreshState(isRefreshing = false)
LaunchedEffect(state.isRefreshing) {
if (state.isRefreshing) {
delay(2000)
state.isRefreshing = false
}
}
SwipeRefresh(
state = state,
onRefresh = { state.isRefreshing = true },
) { ... }
oday
05/07/2022, 3:17 PMval passwordRequester = remember { FocusRequester() }
Card(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 32.dp),
elevation = 4.dp
) {
Column(
modifier = Modifier.padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
EmailInput(
modifier = Modifier.fillMaxWidth(),
email = email,
onEmailChanged = onEmailChanged
) {
// HERE
passwordRequester.requestFocus()
}
Spacer(modifier = Modifier.height(16.dp))
PasswordInput(
modifier = Modifier.focusRequester(passwordRequester),
password = password,
onPasswordChanged = onPasswordChanged,
onDoneClicked = onAuthenticate
)
}
}
CLOVIS
05/08/2022, 6:58 PMposition: absolute
. What's the correct way to do something like display a shape that is above the rest of the contents?eygraber
05/09/2022, 12:00 AMandroidx.compose.runtime.Immutable
annotation class locally, will the compiler plugin pick it up if I use that project as a dependency in another project?Dazai
05/09/2022, 3:14 AMval windowSize: State<DpSize> = windowSize().map {
with(LocalDensity.current) {
DpSize(it.first.toDp(), it.second.toDp())
}
}.collectAsState(DpSize(800.dp, 600.dp))
Dazai
05/09/2022, 3:14 AMhfhbd
05/09/2022, 8:17 AMtheapache64
05/09/2022, 8:24 AMAbhinav Sharma
05/09/2022, 8:25 AM@Composable
fun Foo() {
// call to load image from coil
}
Foo makes image call when on its first composition
and due to any reason if Foo is recomposed before first call could be a success
Coil makes another image load call
Is there a way to avoid this?
cc @Colin Whitemertceyhan
05/09/2022, 10:13 AMhttps://user-images.githubusercontent.com/15737675/38328329-e7008c06-384a-11e8-8449-9f2e396d2bc5.gif▾
theapache64
05/09/2022, 10:26 AMFatal Exception: java.lang.IllegalArgumentException
Cannot round NaN value.
kotlin.math.MathKt__MathJVMKt.roundToInt (MathKt__MathJVMKt.java:1132)
androidx.compose.animation.core.VectorConvertersKt$IntOffsetToVector$2.invoke-Bjo55l4 (VectorConverters.kt:172)
It looks like its thrown from the animation framework . Full stacktrace in 🧵Akram Bensalem
05/09/2022, 11:37 AMdead.fish
05/09/2022, 11:55 AM.then()
would replace the configuration of earlier modifiers. Now I stand corrected that an application of the .padding(...)
modifier and an additional Modifier.padding(...)
applied via .then()
is actually additive. Is this really so or did I hit a weird bug here?
I looked into the implementation of padding and this just measures / places the contents, I guess the culprit might be somewhere in CombinedModifier
which I haven’t fully understood how it works (and if there is special code somewhere that folds “padding” modifiers by adding their values together).Chris Fillmore
05/09/2022, 1:30 PMMehdi Haghgoo
05/09/2022, 1:44 PMAaron Waller
05/09/2022, 1:56 PMrook
05/09/2022, 7:29 PMval someFun: (@Composable () -> Unit)? = null
someFun?.invoke() ?: BasicText(text = "Foo")
Edit: Found the issue in the bug tracker: https://issuetracker.google.com/issues/198511576. Unfortunately, it’s still not fixed.xxfast
05/10/2022, 1:35 AM.clip()
with an inverted shape, so to say. A coloured circle shape wouldn't work here because the surface colours are all transparent.aoriani
05/10/2022, 3:01 AMManideep Polireddi
05/10/2022, 5:52 AMjava.lang.IllegalStateException: Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied
But we are not able to figure out which part of our source is causing this problem since all of the stacktrace points to android framework, compose runtime and animation library. Full stacktrace in the 🧵
Note: the crash is intermittent and we are able to reproduce it a few times, when the app is changing orientation from landscape back to portrait.
Can anyone help us figure out how we can get to the root cause for this crash?Alexander Maryanovsky
05/10/2022, 7:13 AMClassCastException
here. Seems like a Compose compiler/runtime bug.Michał Diner
05/10/2022, 7:44 AMSatyam G
05/10/2022, 9:04 AMscana
05/10/2022, 12:26 PMCustomTheme {
// screen A content
}
CustomTheme {
// screen B content
}
Won't this recreate my fonts/colors all over again? What would be the best approach here?Kevin Del Castillo
05/10/2022, 1:30 PMChris Fillmore
05/10/2022, 5:37 PMIntent
for the notification’s setContentIntent()
? I’m trying to avoid having the composable know about its host Activity. Clicking the notification will launch that Activity. I can think of a few things I could do:
• Pass in a lambda like intent: () -> Intent
to invoke anytime I need an intent
• Pass in the Activity Class<?>
• CompositionLocal? (bad idea?)Jorge Domínguez
05/10/2022, 7:51 PMLazyColumn
?
LazyColumn {
tasksList.forEach { task ->
item {
TaskItem(
taskName = task.name,
onStartTask = { onStartTask(task) }
)
}
}
}
I'd like to animate a TaskItem
if the corresponding Task
object is not present in the next tasksList
passed to LazyColumn
Rohil Chodankar
05/10/2022, 8:13 PM1.0.5
all tests are executed successfully. But now we are trying to upgrade the compose version to 1.1.0
but some of the test fail when executed as unit test. But the same test work when executed as an instrumentation test. We have tried to update robolectric version to the latest 4.8.1
but that didn't work.
After debugging a bit, it looks like the following step doesn't complete execution.
rule.onNodeWithText("some text").assertExists()
Internally it ends up in a loop in RobolectricIdlingStrategy.runUntilIdle()
. Anyone who has faced similar issue?goku
05/10/2022, 9:05 PMModifier.padding
?Chris Fillmore
05/10/2022, 9:10 PMModalBottomSheetLayout
with insets? The sheet goes up to the top of the screen, under the status bar.
Is this just something we should avoid doing (for now?)Chris Fillmore
05/10/2022, 9:10 PMModalBottomSheetLayout
with insets? The sheet goes up to the top of the screen, under the status bar.
Is this just something we should avoid doing (for now?)MR3Y
05/10/2022, 9:22 PMChris Fillmore
05/10/2022, 9:22 PM