Hi, is this normal for the Navigation Bar item com...
# compose
a
Hi, is this normal for the Navigation Bar item component when switching tabs? Should it recompose? (Because of the animation?)
s
the tabs read some sort of selected state right? and that state changes when you switch tabs, so components that read that state (the tabs) recompose
a
Yes, it should recompose but its doing a bit much no? the counter seems a bit high to me
s
Is there some sort of animation playing on the component as it changes state? If yes, disable it and see how things look like in the inspector
a
I disabled the ripple but there seems to be an animation on the color, at least thats what I can find the the source code, I still dont like how high the counter goes
s
Start removing things until you stop seeing the recomposition count go up like that. That's one way to figure out what introduces this. But besides that, did you notice any performance issues, or are you just assuming there will be some here?
a
I removed everything that can cause recompositions
other than the index being set and read nothing else is changing
No performance issues, everything seems to be smooth, but I was doing some looking around and this caught my eye
The text itself is always the same so it should not really recompose.
the color of it being animated might
s
> I removed everything that can cause recompositions Including
NavigationBarItem
? Replacing it with a simple
Text()
composable for example?
a
Hmm good point i will try that now
Copy code
var selectedTab by remember { mutableIntStateOf(0) }
OrdersNavigationBar(
    selectedTab = selectedTab,
    onTabChange = { selectedTab = it }
)
🤔