-
Notifications
You must be signed in to change notification settings - Fork 224
Add ability to customize whether label should be rendered beneath or beside icon #103
Conversation
@satya164 @brentvatne who could help review this? |
cc @satya164 - what do you think? |
Looks good, but I'd change the option name to something simpler. Words like beneath will be prone to typos imo. |
looks nice, but what about |
@slorber - if we use |
The current name was inspired by internal variables but I agree we can do better. How about |
I think |
a384867
to
1a5c3fc
Compare
went with |
1a5c3fc
to
ed20bea
Compare
any additional feedback @brentvatne @satya164? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left some comments. i don't think i'm totally on board with the tabDirection
name, it's unclear to me what this means. tabBarItemOrientation
might be better
src/views/BottomTabBar.js
Outdated
|
||
if (tabDirection) { | ||
let direction; | ||
if (typeof direction === 'string') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will never be a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Err, this is supposed to be tabDirection
. I'll check later but this may not be the latest commit :(. My bad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
src/views/BottomTabBar.js
Outdated
if (typeof direction === 'string') { | ||
direction = tabDirection; | ||
} else { | ||
direction = tabDirection({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this else clause will only be entered when tabDirection
is falsey, and then we try to call tabDirection
as a function which will error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're checking tabDirection
above
src/views/BottomTabBar.js
Outdated
@@ -23,6 +23,7 @@ export type TabBarOptions = { | |||
showIcon: boolean, | |||
labelStyle: any, | |||
tabStyle: any, | |||
tabDirection: any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use better type for this, unclear what it's meant to be and what the default is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modeled the type after how I'd to it in typescript. Let me know if there's a better way to do this in flow. After this goes in I may take a stab at typing more of the any
's in this file.
ed20bea
to
cf414b0
Compare
@brentvatne updated name to |
Orientation doesn't feel right to me either. It sounds like potrait or landscape orientation. IMO |
position is confusing as @brentvatne mentioned for when we want to have proper RTL support. It's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed with @brentvatne and I think tabBarPosition: 'beside-icon' | 'below-icon'
sounds the best
216d55c
to
3e5caa9
Compare
@satya164 updated! |
sorry for another change here 😅 i think that |
@brentvatne that's a fair point. A lot of the previous naming proposals like tabDirection row/column were referring to the entire tab item since that's what this change is really about. The new naming does make it specific to having an icon and a label and how they're position relative to each other. |
oops sorry, my mistake. I meant to say |
Hey. Just wonder if we shouldn't plan for supporting next having the label on right left top or bottom. I feel the 2 value names chosen would not permit to add the 2 potential other values here and may lead to a breaking change |
Also feed orientation to the label render function
3abadef
to
8034f4b
Compare
@brentvatne @satya164 updated to @slorber label on the right/bottom isn't something I've seen in any app so I'm not sure we want to support it just because we can. With that said, if it becomes a use-case it's easy to add support for new values and possibly deprecate the existing ones over time. That wouldn't be a breaking change. For the time being, I like that we're constraining the names to the capabilities supported. |
Motivation
The BottomTabBar options allow for very fined grained customization but were missing a couple extension point to allow apps to override whether labels should be rendered beneath or beside the icon
Test plan
tabBarLabel
option.shouldRenderLabelBeneath
option can be used to override the default behavior.