Tgo1014
03/10/2022, 12:33 PMAlexander Black
03/10/2022, 5:34 PMAnudeep Ananth
03/11/2022, 3:24 AManiruddha dhamal
03/11/2022, 3:30 AMAlexander Maryanovsky
03/11/2022, 6:42 AM@Compose
function is not being skipped?Stylianos Gakis
03/11/2022, 11:32 AMnan
03/11/2022, 1:59 PMLayout
to wrap 2 buttons to create a custom layout, one is OutlinedButton
and another is Button
. But when I pressing on the Button
, the whole custom layout starting flash, it seems the whole Layout keep recompose(I add the log in Layout’s MeasurePolicy lamda and it keeps printing). However, it doesn’t happen if I press on OutLineButton
. How could I avoid this?
Thanks.
elevation
to null
, the problem is gone. But is there method that keep elevation and let Layout works as expected? 🤔myanmarking
03/11/2022, 3:35 PMval onItemClicked = { index: Int ->
listInfoState.animateScrollToItem(index)
}
Why would this cause the excess recomposition i am having, without evening triggering the click ?Kata
03/11/2022, 3:53 PMcollectAsLazyPagingItems
. Everything works fine until I scroll to a position which is bigger than the pagingSize and then I call invalidate()
to get the pager data to reload. After this the lazyItems
first only reloads the data for the visible viewport. My problem is that the rememberLazyListState()
is not calculating the right position in this case and the scroll position is wrong. When I delete an item from the first half of the list that is < pagingSize then everything works fine. Is there something like: rememberPagingLazyListState()
or am I making a mistake and it is supposed to work with rememberLazyListState()
?chansek
03/11/2022, 4:45 PMfun AddressPicker(
sheetState: ModalBottomSheetState,
onConfirm: (Address) -> Unit
) {
ModalBottomSheetLayout(
sheetState = sheetState,
sheetContent = { AddressForm(onConfirm) }
) {}
}
Then I added this into my nav graph:
composable(route = Screen.AddressPickerScreen.route) {
AddressPicker(sheetState = sheetState) {
// ...
}
}
And to show it, I used below code:
navController.navigate(Screen.AddressPickerScreen.route)
Instead of showing the sheet content, it shows a blank canvas. What am I doing wrong?lhwdev
03/11/2022, 4:47 PMvalue
?
var value = false
SomeComposable { item -> // content block
if(item) value = true
// etc.
}
SomeComposable internally runs for loop. Will it run like normal for loop? Will content block
recompose by itself, making value
inconsistent?Siyamed
03/11/2022, 5:02 PMRavi
03/11/2022, 5:10 PMVlad Makarenko
03/11/2022, 9:26 PMspierce7
03/11/2022, 9:52 PMcolintheshots
03/11/2022, 11:09 PMandrew
03/11/2022, 11:16 PMlesincs
03/12/2022, 6:00 AMColumn
with Modifier.verticalScroll()
or LazyColumn
? Seems for every scrollable page we can just use LazyColumn
, but the `item {}`makes the development a little bit cumbersome, can I just use Column
for the pages which don’t have infinite scrollable content?jasu
03/12/2022, 7:56 AMNoteListComponent(
notes: List<Note>
…coupleOfParameters
) {
var searchText by rememberSaveable { mutableStateOf("") }
LaunchedEffect(key1 = searchText) {
notesViewModel.searchNotes(searchText)
}
LazyList(...withParams)
}
Nat Strangerweather
03/12/2022, 4:59 PMchansek
03/12/2022, 5:07 PMandroid:windowSoftInputMode="adjustResize"
But if my TextField
is inside a ModalBottomSheet
, then this doesn't work. What should be the fix for this?ritesh
03/13/2022, 2:33 AMStable
- as they are declared immutable.
When declaring a data class or a class which can hold an Immutable
as data-structures are not Stable by default?
Or compose compiler can infer?
@Immutable
data class MyClass {
val someId:Int,
val myList:List<SomeClass>
}
rsktash
03/13/2022, 4:38 AMrsktash
03/13/2022, 6:06 AMzalewski.se
03/13/2022, 8:58 AMCard(
shape = RoundedCornerShape(8.dp),
elevation = 10.dp
)
ziv kesten
03/13/2022, 10:29 AMBottomSheetScaffoldState
? i would like to perform an action when its state is BottomSheetValue.Collapsed
I tried using LaunchedEffect but it is not triggered
val bottomSheetScaffoldState = rememberBottomSheetScaffoldState(
bottomSheetState = BottomSheetState(BottomSheetValue.Expanded)
)
SomeComposableWithBottomSheet(state: BottomSheetScaffoldState)
LaunchedEffect(bottomSheetScaffoldState){
if (bottomSheetScaffoldState.bottomSheetState.isCollapsed) {
onBackPress()
}
}
theapache64
03/13/2022, 11:40 AMrememberUpdateState
I’ve seen most of the @Composables
are using rememberUpdateState
before invoking a lambda.
For eg, BackHandler
internally calling rememberUpdateState
on onBack
lambda, clickable
modifier calls on onClick
lambda.
Does that mean we should wrap all lambda with rememberUpdateState
before invoking ? 🤔
If that’s the case, why can’t compiler do it for us?
#possibly_a_stupid_questionColton Idle
03/13/2022, 5:29 PM@Composable
fun SomeScreen(
viewModel: SomeScreenViewModel = hiltViewModel(),
someIdINeed: String = ""
) {
viewModel.init(someIdINeed)
MyActualScreenContent()
}
The viewModel.init(id) should go inside of a remember{}? Or is it better to do LaunchedEffect(Unit)?
edit: I almost wonder how viable it'd be to create a lint rule or something that would flag this sort of stuff in a composable. The above code was in our codebase for like 3 months before i noticed it just now.S.
03/13/2022, 8:57 PMKeyboardType.Number
still allows special characters while android:inputType="number"
doesn'tRafiul Islam
03/14/2022, 7:57 AMRafiul Islam
03/14/2022, 7:57 AMStylianos Gakis
03/14/2022, 11:40 AMAlbert Chang
03/14/2022, 12:41 PMRafiul Islam
03/14/2022, 1:16 PMStylianos Gakis
03/14/2022, 1:22 PMRafiul Islam
03/14/2022, 1:28 PMStylianos Gakis
03/14/2022, 1:34 PM