Skip to content
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

Use MaterialTopTabNavigator for main navigation #2831

Closed
wants to merge 8 commits into from

Conversation

borisyankov
Copy link
Contributor

This is based on the React Navigation 2 PR.

The last commit uses the new MaterialTopTabNavigator which is recommended to best follow Material design guidelines (it is also more configurable and nicer)

@gnprice
Copy link
Member

gnprice commented Jul 25, 2018

Thanks! As you see in my comment earlier today over here: #2702 (comment) , I am interested in exactly this switch :)

For this PR, I'm looking at the tip commit since that's the one that's new relative to #2702 . That commit does a bunch of other things too, in addition to switching to MaterialBottomTabNavigator (btw the commit message and PR title seem to have the name flipped); those changes generally look like good improvements (like clarifying the naming around StreamTabs), but seem independent of the change of navigator component, and like they'd be clearer as separate commits.

When the other refactors and improvements are separated out, does the change that actually switches to MaterialBottomTabNavigator end up being very big? Perhaps it'd be simplest to skip moving MainTabs over to MaterialTopTabNavigator (one of the commits in #2702 ), and move it straight to MaterialBottomTabNavigator.

@borisyankov
Copy link
Contributor Author

The Top navigator switch is trivial complexity-wise so I think we can go ahead and merge them sooner and logically it makes sense as the purpose is to preserve the previous behavior.

The last commit that implements the Bottom one is marked as WIP yet, as there is a small behavioral change in the way tabs scroll - you can't scroll from one to the other as before. On the other hand, this new behavior is consistent with most apps work (YouTube, Twitter) so I am not so concerned.

Another thing I will need to figure-out - on transition to another tab, there is some color used to 'blend' to a new tab. When our background is white, it looks like a proper blending transition. When we are on the night theme, the same color results in a 'flashing' transition and not blending.

@borisyankov
Copy link
Contributor Author

Some of the changes in the last commit (and the purpose of this PR) are both an improvement in the structure of the app and also needed for this Bottom-Material component to work (it sets a background and doesn't work with our philosophy of 'transparent background simplifies stuff')

I'll split this into several commits too. From coding perspective, I think they will be simple but will be good that you test the behavior by running the branch to verify if it feels good in use.

@zulipbot
Copy link
Member

Heads up @borisyankov, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/master branch and resolve your pull request's merge conflicts accordingly.

Upgrade to React Navigation 2 and do the minimal changes that make
our code compatible.

Navigating behavior has changed, and pushing a route with the
same key does not result in duplicated entry in the history.
Fixes zulip#2682

The code to wire RN navigator to Redux have changed. The newer
approach is simpler, just using `reduxifyNavigator` helper does
most of the work.
Update definitions by running `flow-typed update`.

This lets Flow know about the new constructor functions.
`NavigationActions.pop` was removed in RN v2 and now `back` behaves
the same as `pop` before. We used `pop` to skip several routes if
they have the same key ('chat' in our case) but this matches
the new behavior of 'back'.
The `StackNavigator` constructor function has been deprcated.
Using the `createStackNavigator` that expects the same inputs.
`TabNavigator` constructor is deprecated in favor of the function
'createMaterialTopTabNavigator'. Our config no longer needs some
parameters passed, so this is simplified while keeping the very
same behavior.
Replace `TabNavigator` constructor with `createMaterialTopTabNavigator`
creator function which is the one that matched the old behavior.

Note: While `createBottomTabNavigator` sounds like what we might need,
it is a simpler navigator compared to what we were using and actually
`createMaterialTopTabNavigator` is the correct one.
The type `NavigationNavigateAction` we use is too specific and
not the correct one. We want the `NavigationAction` type instead.

Also, to make it simpler and consistent, we rename our own type
`NavigateAction` to `NavigationAction`.
@gnprice gnprice added the experimental UI/UX To be user-tested in experimental build label Nov 16, 2018
@gnprice
Copy link
Member

gnprice commented Aug 12, 2019

The further work discussed above never happened; the PR still says the opposite of what it does, among everything else.

With the way we actually did the react-navigation v2 upgrade (in #3573), we never switched to the inappropriate createMaterialTopTabNavigator for our main, bottom, tabs in the first place as #2702 did. We're now using createBottomTabNavigator from react-navigation-tabs, and it seems fine. So I don't think there's any further useful work to do in this direction; closing.

@gnprice gnprice closed this Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experimental UI/UX To be user-tested in experimental build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants