Siddharamesh
Siddharamesh

Reputation: 93

How to disable tabBarBadge in navigation v5 createbottomtabNavigator?

To display notifications badge, I found out I can use tabBarBadge from react-navigation. tabBarBadge accepts only a number or a string and not a function, so I couldn't figure out a way to disable it when the user is focused on the notifications screen. How can I disable it?

enter image description here

enter image description here

In the tabBarIcon there is tabInfo.focused that lets us know when the user is on this screen. Is there a similar method for tabBarBadge?

Upvotes: 2

Views: 2179

Answers (1)

Anhdevit
Anhdevit

Reputation: 2104

when when the user is focused on the notifications screen set tabBarBadge: null

Upvotes: 5

Related Questions