Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashing in bottom navigation #420

Open
SwathiVishwa opened this issue May 20, 2024 · 0 comments
Open

Crashing in bottom navigation #420

SwathiVishwa opened this issue May 20, 2024 · 0 comments

Comments

@SwathiVishwa
Copy link

@composable
private fun DashBoardPage() {
Surface {
TabNavigator(tab = HomeScreen) {
Scaffold(

            bottomBar = {
                BottomNavigation {
                    TabNavigationItem(tab = HomeScreen)
                    TabNavigationItem(tab = HomeScreen)
                    TabNavigationItem(tab = ProfileScreen)
                }
            }
        ) {
            Column(modifier = Modifier.padding(it)) {
                CurrentTab()
            }
        }
    }
}

}
@composable
fun RowScope.TabNavigationItem(tab: Tab) {
val tabNavigator = LocalTabNavigator.current
BottomNavigationItem(selected = tabNavigator.current == tab,
onClick = {
tabNavigator.current = tab
}, icon = {
Icon(painter = tab.options.icon!!, contentDescription = tab.options.title)
})
}

becasuse BottomNavigationItem app is crashing if we comment complete BottomNavigationItem then bottom bar is visible but there is not icon and tilte but if we uncomment the BottomNavigationItem then app is throwing below error

java.lang.NoSuchMethodError: No static method restrictedConstraints-xF2OJ5Q$default(Landroidx/compose/ui/unit/Constraints$Companion;IIIIZILjava/lang/Object;)J in class Landroidx/compose/ui/unit/Constraints$Companion; or its super classes (declaration of 'androidx.compose.ui.unit.Constraints$Companion' appears in /data/app/com.app.findu-o1dwK1rVlsHIV58hiXCh7Q==/base.apk)
at androidx.compose.foundation.layout.RowColumnMeasurementHelper.measureWithoutPlacing-EkL-Y(RowColumnMeasurementHelper.kt:183)
at androidx.compose.foundation.layout.RowColumnMeasurePolicy.measure-3p2s80s(RowColumnImpl.kt:72)
at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:135)
at androidx.compose.foundation.layout.UnspecifiedConstraintsNode.measure-3p2s80s(Size.kt:1074)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:188)
at androidx.compose.foundation.layout.InsetsPaddingModifier.measure-3p2s80s(WindowInsetsPadding.kt:155)
at androidx.compose.ui.node.BackwardsCompatNode.measure-3p2s80s(BackwardsCompatNode.kt:312)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:188)
at androidx.compose.foundation.layout.FillNode.measure-3p2s80s(Size.kt:699)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:188)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:316)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:315)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant