compose-recomposition Questions

3

I have a simple Jetpack Compose application that uses the Navigation Component. My UI is comprised of the following composables (redacted UI to be concise): NavHost: @Composable fun NavHost( nav...

5

@Composable functions are recomposed if one the parameters is changed or if one of the parameters is not @Stable/@Immutable When passing items: List<Int> as parameter, compose always recomp...
Convolute asked 10/9, 2021 at 19:38

2

Solved

I have an MVI architecture with and activity containing the main screen class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanc...

3

I am getting IndexOutOfBoundsException when I remove items in mutableStateListOf, where MyType is some custom Type. There are almost around 250 items in myList. The items are removed in a loop. Alm...

2

Solved

I found out that the composable screens are getting recomposition multiple times during navigation from Navhost compose the following example shows how I'm integrating the navigation with logs to i...

3

Solved

Consider snippet below fun doSomething(){ } @Composable fun A() { Column() { val counter = remember { mutableStateOf(0) } B { doSomething() } Button(onClick = { counter.value += 1 }) { Text...
Swampy asked 1/2, 2023 at 12:34

1

Solved

I'm updating the uiState by calling a corresponding function via clicking the first composable. The second composable recomposes because of it, although it doesn't take any state parameters, only a...

2

I am writing an Android app using Jetpack Compose. I have a Composable called MultiSelectGroup which needs to modify and return a list of selections whenever a FilterChip is clicked. Here is the co...

3

Solved

I'm confused, can someone explain me the difference between: val variable by remember { mutableStateOf() } and val variable by rememberUpdatedState() When I check the source code of rememberUpdat...
Earsplitting asked 7/9, 2021 at 8:45

3

I have a text which need to be animated to show and hide with the value is null or not. it would have been straight forward if the visibility is separately handle, but this is what I got. In the be...

1

Solved

Looking at the documentation of Immutable, there's a code example: @Immutable data class Person(val name: String, val phoneNumber: String) @Composable fun PersonView(person: Person) { Column { R...
Mackle asked 26/4, 2023 at 13:25

3

Android Studio Bumblebee Patch 3 From this page, it says that I can see recomposition counts: https://developer.android.com/jetpack/compose/tooling#recomposition-counts It does not show the menu op...

2

Solved

I'm trying to do some list operations and I've run into the issue of all items recomposing when a single item update. https://prnt.sc/8_OAi1Krn-qg My models; data class Person(val id: Int, val name...

1

Solved

I have the following composable function. Its a simple login screen with username, password and submit button. If username or password fields are empty when the user clicks on the submit button a s...
Archduchy asked 27/11, 2022 at 8:43

2

Solved

How do I create a Arc Progress bar animation like this Currently I've already used Canvas to draw an arc and added animations to the progress bar using animateFloatAsState API. But second pic is n...

1

Solved

I'm trying to actively observe the soft keyboard visibility, currently, I'm trying to observe it with WindowInsets.isImeVisible but I can't seem to observe its state change. Someone mentioned usin...

1

Solved

When I modify the properties of the objects in the List, the UI does not update my code: @OptIn(ExperimentalFoundationApi::class) @Composable fun ContactCard( ) { var stateList = remember { m...

1

Solved

I was trying to create a sample Tab View in Jetpack compose, so the structure will be like Inside a Parent TabRow we are iterating the tab title and create Tab composable. More precise code will be...

2

Solved

While studying through the Jetpack Compose sample project, I saw @Stable and @Immutable annotations. I've been looking through the Android documentation and GitHub about those annotations, but I do...
Monochromatism asked 29/7, 2021 at 12:28

2

Solved

I have a LazyColumn with nested LazyRows (similar to Netflix or Spotify home page feed). In short, the issue I'm having is that when the content of the page changes, the scrolling positions of the ...

1

In Android I often want to navigate is response to state change from a ViewModel. (for example, successful authentication triggers navigation to the user's home screen.) Is the best practice to tri...

1

Solved

So here's an odd one, I think. I'm showing a list of Textfields in a LazyColoumn. The user can remove each of the textfields, but when doing so, it copies the value from REPLACE textfield. What's...

1

Solved

I'm creating a custom slider control for my app but I can't avoid unnecessary recomposition without adding some ugly hacks... CustomSlider1 is a component that recomposes all its children when the ...
Lambrecht asked 8/11, 2022 at 13:2

1

Solved

I have a list which is stored inside a Viewmodel via Stateflow. class FirstSettingViewModel : ViewModel() { private val _mRoomList = MutableStateFlow<List<InitRoom>>(mutableListOf()) ...

1

Solved

It is a video call screen . It needs token and channel name to work which needs to be passed to init call engine. I am storing these in a data class which is used as a mutable state. Screen State D...

© 2022 - 2025 — McMap. All rights reserved.