Skip to content

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

Conversation

cpjolicoeur
Copy link
Contributor

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

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
@davidLeonardi
Copy link
Contributor

Can you post a screenshot of before/after?

@cpjolicoeur
Copy link
Contributor Author

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

@davidLeonardi
Copy link
Contributor

This looks really nice indeed! Will merge it soon. Thanks!
On Tue, 1 Mar 2016 at 18:01, Craig P Jolicoeur [email protected]
wrote:

Sure, I'll actually block out the sections with color to make it more
obvious.

Here is the initial top level navigation page:

https://camo.githubusercontent.com/09dee45e9685744a4d97835a2ffa874263e0c9a7/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f7370612f3536343973647474727172756136632f646e757462376d7a2e706e67

Here is the current version of the code without this PR:

https://camo.githubusercontent.com/1d6fbe3b93bbd545a511262c60d88544603d24e4/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f7370612f3536343973647474727172756136632f6e756a6463616b642e706e67

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:

https://camo.githubusercontent.com/4e34b618dba378f2468dab53cc8a4f007bbe41d2/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f7370612f3536343973647474727172756136632f64635f306e7475682e706e67

This blocks out the right content always to allow good centered flex for
the title content


Reply to this email directly or view it on GitHub
#83 (comment)
.

@charpeni
Copy link
Contributor

charpeni commented Mar 1, 2016

Thank you @cpjolicoeur !

In this case, I think we should just remove the condition. What do you think guys ? @cpjolicoeur @SEthX

@cpjolicoeur
Copy link
Contributor Author

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.

@davidLeonardi
Copy link
Contributor

I think the condition logic can be improved too.
Wanna do that @cpjolicoeur ?

@cpjolicoeur
Copy link
Contributor Author

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?

@charpeni
Copy link
Contributor

charpeni commented Mar 2, 2016

I also would change the default text alignment for the title to be center aligned and not right aligned as the current library default is here.

You mean left ?

@cpjolicoeur
Copy link
Contributor Author

sorry, left yes. I'll update my comment accordingly

@charpeni
Copy link
Contributor

charpeni commented Mar 2, 2016

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.

@cpjolicoeur
Copy link
Contributor Author

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.

@davidLeonardi
Copy link
Contributor

I didnt know about this spec in material design.
My ignorant opinion is that we should follow design specs for the
respective platforms, so as long as its conformant im happy ;)
On Wed, 2 Mar 2016 at 19:05, Craig P Jolicoeur [email protected]
wrote:

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.


Reply to this email directly or view it on GitHub
#83 (comment)
.

@davidLeonardi davidLeonardi added this to the 0.9.0 milestone Mar 3, 2016
davidLeonardi added a commit that referenced this pull request Mar 14, 2016
Center navigation content title always
@davidLeonardi davidLeonardi merged commit 498bf0e into react-native-simple-router-community:master Mar 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants