Skip to content

Conversation

@OSPFNeighbour
Copy link
Contributor

@OSPFNeighbour OSPFNeighbour commented Jun 11, 2018

Pressing the Home button will empty the home stack (basically takes you back home).

Theres a minor animation glitch due to the nav action but ill see what IOS does with it before I work to hard to fix it.

@codecov
Copy link

codecov bot commented Jun 11, 2018

Codecov Report

Merging #497 into master will increase coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #497      +/-   ##
==========================================
+ Coverage   28.18%   28.19%   +0.01%     
==========================================
  Files         172      172              
  Lines        2803     2802       -1     
  Branches      412      412              
==========================================
  Hits          790      790              
+ Misses       1702     1701       -1     
  Partials      311      311
Flag Coverage Δ
#integration 0% <ø> (ø) ⬆️
#unittests 28.73% <0%> (+0.01%) ⬆️
Impacted Files Coverage Δ
client/src/navigation/HomeNavigator.js 0% <ø> (ø) ⬆️
client/src/navigation/MainNavigator.js 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dcaf831...71c1916. Read the comment docs.

@sdunster
Copy link
Member

even with the client upgrades etc this is still necessary?

NavigationActions.navigate({ routeName: 'Root' }),
],
});
navigation.dispatch(resetAction);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you try ditching the reset and just using navigation.navigate('Root');?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might help if you explain what you tried before you came to this being the best option

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the first thing I tried, and its what 'the internet' documents as the correct way to reset a stack.

There is currently nothing in our code to reset the stack and nothing documented in stacknav that would suggest it should be resetting. When we swap tabs it should just keep the set of tabs in that stack in place.

#448

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you just try nav to root you will end up with a weirdly large stack of screens in your stack i believe as it would just add another home screen to the mix.

@sdunster
Copy link
Member

I'd like to stall this a little longer while I try to figure out a better solution.

@OSPFNeighbour
Copy link
Contributor Author

Bump. come up with a better solution or accept my standard, by the book, recommended way of doing it.

@OSPFNeighbour
Copy link
Contributor Author

Bump

@sdunster sdunster force-pushed the tdykes.home_TabNavigator_reset_stack branch from 89b3782 to 71c1916 Compare June 19, 2018 06:28
@sdunster
Copy link
Member

rebased

tabBarIcon: ({ tintColor }) => <Icon size={34} name="home" color={tintColor} />,
},
tabBarOnPress() {
const resetAction = NavigationActions.reset({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you not do this only if the tab is already selected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I played around with detecting that and its possible.

But found that users would be on another tab and want to go home so press home, and it wouldnt take them home, and that was confusing.

@sdunster
Copy link
Member

Ok I tested it and here is what I observed. I don't think your description made it clear.

On iOS normally (before this diff)

  • if you are deep in the home stack hierarchy (you activate home tab and tap on a notification/action which pushes a view onto the stack) then activate another tab, then activate home again the home tab will activate but the nested view stack will be exactly as it was (deep in the hierarchy).
  • tapping home button a second time does not reset the nested stack. For all tabs other than home on iOS this would reset the nested stack to root. I believe this a bug and might just be due to the way we have set up the nested root stack (since it works fine for the other tabs).

After the diff:

  • tapping home button any time (no matter which tab is currently selected) results in the view stack inside the home tab resetting to the root view (list of notifications/actions).
  • this special case only applies to the home tab.
  • I believe this is undesirable for iOS, at least. Instead we should fix the hierarchy so that the nested stack can be reset properly.

I added one more comment inline with a suggested change that I think would satisfy all of my concerns and ensure consistency across platforms although I'd still prefer to avoid the need for it on iOS by fixing the underlying hierarchy problem.

tl;dr I think we should continue to stall this PR and look for a better fix. If you think it is absolutely necessary because navigation is completely undesirable on Android and you wish to make it worse for iOS then I won't stop you from merging it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants