question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to trigger BottomNavigation without clicking

See original GitHub issue

It seems that when we want to change the state of BottomNavigation, we must click to achieve it. When I refresh the page or back to the previous page, I want to change the state of BottomNavigation (such as color), how to achieve it?

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

I want to get the pathname through useLocation, and switch the color of BottomNavigation through pathname. But I cannot trigger the BottomNavigation component through non-click events. suki1

Expected Behavior 🤔

Whether it is refreshing the page or back to the page, the color of the BottomNavigation of the current page can be maintained correctly.

Your Environment 🌎

`npx @material-ui/envinfo`
   System:
    OS: Windows 10 10.0.19042
  Binaries:
    Node: 15.11.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - F:\rematch-jl\node_modules\.bin\yarn.CMD
    npm: 7.6.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Spartan (44.19041.906.0), Chromium (90.0.818.51)
  npmPackages:
    @material-ui/core: latest => 4.11.4
    @material-ui/icons: latest => 4.11.2
    @material-ui/styles:  4.11.4
    @material-ui/system: latest => 4.11.3
    @material-ui/types:  5.1.0
    @material-ui/utils:  4.11.2
    @types/react: latest => 17.0.4
    react: latest => 17.0.2
    react-dom: latest => 17.0.2
    styled-components: latest => 5.2.3
    typescript: latest => 4.2.4

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, May 8, 2021

@arpitBhalla I’m not sure we need a full demo for this, it seems straightforward to implement. What if we start by a simple header section that links back to the routing page?

1reaction
oliviertassinaricommented, May 6, 2021

It seems to me that the author wants to use a value prop, as in https://next.material-ui.com/components/bottom-navigation/#bottom-navigation.

Maybe we should add a header like this one https://next.material-ui.com/components/tabs/#third-party-routing-library in the docs?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bottom navigation doesn't navigate when item is clicked
In Android Studio go to File->New->New Project, then select "Botton Navigation Activity" and look how has it been implemented by google team.
Read more >
Disable Shift Label Animation from Bottom Navigation - Medium
Disable Shift Label Animation from Bottom Navigation — Android. Make Bottom Navigation without animation like youtube, Instagram. Credits ...
Read more >
Navigating with Compose - Android Developers
Navigate calls triggered by other composable functions ... To link the items in a bottom navigation bar to routes in your navigation graph, ......
Read more >
How to Implement Bottom Navigation With Activities in Android?
Navigate to app > res > drawable > right-click > new > drawable resource file and name it as “selector”. Use the following...
Read more >
Flutter Tutorial - Bottom Navigation Bar | The Right Way [2021 ...
Create a Bottom Navigation Bar in Flutter without Routes that keeps the state with the help of IndexedStack in Flutter. Click here to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found