-
Notifications
You must be signed in to change notification settings - Fork 56
Center navigation content title always #83
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
Center navigation content title always #83
Conversation
If we don't show the right corner when we default to show the left corner, we end up with a [ flex 1 | flex 6 ] setup where the title is centered "off-center" because of the uneven flex total of 7. Forcing an empty default right corner gets us back to [ flex 1 | flex 6 | flex 1 ] by default which gives a truly centered nav title
Can you post a screenshot of before/after? |
Sure, I'll actually block out the sections with color to make it more obvious. Here is the initial top level navigation page: Here is the current version of the code without this PR: As you can see the title content takes the rest of the nav content since I dont have a right corner item and makes the text not be centered. Here is the version with this PR: This blocks out the right content always to allow good centered flex for the title content |
This looks really nice indeed! Will merge it soon. Thanks!
|
Thank you @cpjolicoeur ! In this case, I think we should just remove the condition. What do you think guys ? @cpjolicoeur @SEthX |
That was my other thought. I was just trying to mimic existing logic instead of a larger changeset, but I'll leave it to you both to discuss. |
I think the condition logic can be improved too. |
Sure, I can update this PR with a refactor. My original thought was to always block of the left and right corners 100% of the time regardless of the current route stack depth or if corners were provided. This is the more "natural" pattern in both native iOS and Android systems. What I'm suggesting, in reality, probably means removing the conditional logic altogether as the improvement. I also would change the default text alignment for the title to be center aligned and not left aligned as the current library default is here. Thoughts? |
You mean left ? |
sorry, left yes. I'll update my comment accordingly |
Hmm, I'm not sure about that. What do you mean by more "natural" ? If I refer to Material design guidelines, the title is left aligned. |
Yeah, I stand corrected. With the new Material design work Android has changed from default center align. iOS still center-aligns by default, but Android no longer does. Leaving left-align in that case is fine with me as it's, of course, easy enough to change programmatically for the user. |
I didnt know about this spec in material design.
|
Center navigation content title always
If we don't show the right corner when we default to show
the left corner, we end up with a [ flex 1 | flex 6 ] setup
where the title is centered "off-center" because of the uneven
flex total of 7. Forcing an empty default right corner gets us
back to [ flex 1 | flex 6 | flex 1 ] by default which gives
a truly centered nav title