'Wrong ripple in material3 NavigationBar in Jetpack Composee
When I use Material3 NavigationBar
in Jetpack Compose I get wrong rectangular ripple effect like this:
Material3 library version: 1.0.0-alpha06
Code:
NavigationBar(modifier = Modifier.navigationBarsPadding()) {
NavigationBarItem(
selected = ...,
onClick = {
navController.navigate(ScreenComponents(context).mainScreen) {
launchSingleTop = true
}
},
icon = {
...
},
alwaysShowLabel = false,
label = {
Text(text = ..., color = MaterialTheme.colorScheme.onSurface)
}
)
// ...
Solution 1:[1]
Solution 2:[2]
In NavigationBarItem I use this modifier to change the shape of the ripple
modifier = Modifier
.padding(4.dp)
.background(MaterialTheme.colorScheme.background, RoundedCornerShape(24.dp))
.clip(RoundedCornerShape(24.dp))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Gabriele Mariotti |
Solution 2 | Richard Ory |