Change TabNavigator to take in a generic <T: Tab> to allow for sealed class based tabs #371
babramovitch
started this conversation in
Ideas
Replies: 1 comment
-
@DevSrSouza @adrielcafe Just looking to see if this is something you'd be interested in being implemented. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Right now when you're using the tab navigator if you want to do something based on the current tab (or maybe other situations) you don't really know what tab you're on without doing a lookup on the tab options index and since it's not a sealed class, you aren't in an exhaustive situation and then have to handle those what ifs.
Instead, the TabNavigator could take in a generic that extends the Tab which would then allow improvements like using a sealed class for the tabs.
I think it'd be good improvement and I don't think it'd be too disruptive (or disruptive at all) to existing implementations since they all already take a Tab or List in anyway
I've only taken a brief look at it, but it could be something roughly like below, and if there's an openness to having something like this implemented, I'd be willing to dig into it further and make a PR if the end result looks good.
Edit: Also I guess this could be the case for screens as well as tabs
sealed class BottomTabs : Tab
Beta Was this translation helpful? Give feedback.
All reactions