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

Configuration changes not handled - Tab Options #369

Open
pitampoudel opened this issue Mar 15, 2024 · 0 comments
Open

Configuration changes not handled - Tab Options #369

pitampoudel opened this issue Mar 15, 2024 · 0 comments

Comments

@pitampoudel
Copy link

I have defined a Tab as:

data object CampaignsTab : Tab {
    override val options: TabOptions
        @Composable
        get() {
            val title = SharedRes.strings.label_campaigns.desc().localized()
            val icon = rememberVectorPainter(Icons.Default.Campaign)
            return remember {
                TabOptions(
                    index = 0u,
                    title = title,
                    icon = icon
                )
            }
        }
  }

And I am consuming that as:

    NavigationBar {
        remember { listOf(CampaignsTab, LeaderboardTab) }.forEach { tab ->
            val tabNavigator = LocalTabNavigator.current
            NavigationBarItem(
                selected = tabNavigator.current == tab,
                onClick = { tabNavigator.current = tab },
                icon = {
                    tab.options.icon?.let { icon ->
                        Icon(
                            painter = icon,
                            contentDescription = tab.options.title
                        )
                    }

                },
                label = { Text(tab.options.title) }
            )
        }
    }

I expect my bottom navigation bar texts to change automatically whenever the app language changes like all other components.

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