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

Add ability to replace the nav stack while pushing a new screen onto the nav stack. #809

Merged
merged 1 commit into from
Apr 24, 2018

Conversation

andrewhavens
Copy link
Collaborator

This adds the ability to replace the current nav stack. This is an essential feature when dealing with navigation controllers.

@andrewhavens andrewhavens merged commit 6d312fe into master Apr 24, 2018
@andrewhavens andrewhavens deleted the feature/replace-nav-stack branch April 24, 2018 23:50
@@ -75,6 +76,11 @@ def push_view_controller(vc, nav_controller=nil, animated=true)
nav_controller.pushViewController(vc, animated: animated)
end

def replace_nav_stack(screens, args = {})
args[:animated] ||= true
Copy link
Owner

Choose a reason for hiding this comment

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

This will always set args[:animated] to true (even if you set it manually to false).

Instead, try this:

args[:animated] = true if args[:animated].nil?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops, you're right.

@@ -218,7 +218,7 @@
it "should open the provided view controller as root view if no other conditions are met" do
parent_screen = HomeScreen.new
new_screen = BasicScreen.new
parent_screen.mock!(:open_root_screen) { |vc| vc.should.be == new_screen }
parent_screen.mock!(:open_root_screen) { |vc, args| vc.should.be == new_screen }
screen = parent_screen.open_screen new_screen
screen.should == new_screen
end
Copy link
Owner

Choose a reason for hiding this comment

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

Add a test for this maybe?

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.

2 participants