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

Swipe back navigation overrides ActionBar styles (iOS) #7430

Closed
mudlabs opened this issue Jul 1, 2019 · 3 comments · Fixed by #8252
Closed

Swipe back navigation overrides ActionBar styles (iOS) #7430

mudlabs opened this issue Jul 1, 2019 · 3 comments · Fixed by #8252

Comments

@mudlabs
Copy link
Contributor

mudlabs commented Jul 1, 2019

Environment

  • NativeScript Playground
  • iOS

Describe the bug
Navigating back on iOS via the default swipe back navigation removes all ActionBar styles to the default iOS style. And if the swipe back navigation event is started but not completed the styles remain changed.

To Reproduce / Sample project
See Playground

Expected behavior
ActionBar styles of the navigating page are not overridden.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@mudlabs
Copy link
Contributor Author

mudlabs commented Jul 1, 2019

I believe this happens because the iOS ActionBar UI component is shared by both pages.

Even though it's not being used by the first page, swiping back transitions the ActionBar styles to the default style (since no style was specified).

I've updated the Playground so you can test this behaviour. The Home Page now has an ActionBar (hidden) with custom styles. Swiping back will change the ActionBar to these styles. So this is how you can overcome the first issue (though its a hack and should not be needed).

The second issue remains though. If you begin swiping back the ActionBar will take on the styles off the page you are navigating back to; the navigatingFrom event is also raised here. If the swipe is canceled (i.e you don't navigate from the page) the ActionBar does not return to the styles of the current page, as it was before swipe.


  • Swipe back navigation triggers the navigatingFrom event.
  • There should be a swipeBackObserver attached to the ActionBar, Page, or Frame in place to manage this behaviour.
  • The minutiae of synchronising the ActionBar from page-to-page is NOT something developers should have to manage. Beyond the use of actionBarHidden and enableSwipeBackNavigation.

@mudlabs
Copy link
Contributor Author

mudlabs commented Jul 2, 2019

Looks like we need to register notifyWhenInteractionChanges of UIViewControllerTransitionCoordinator inside the delegate of NativeScript/tns-core-modules/ui/frame/frame.ios.ts.

This would allow {NS} to detect if the swipe event was cancelled and reset the ActionBar to the appropriate styles.

@NickIliev NickIliev added the bug label Jan 10, 2020
@NickIliev
Copy link
Contributor

NickIliev commented Jan 10, 2020

Reported via t.1448746

Steps to reproduce:

  1. Deploy this application
  2. Navigate to item-details (red action-bar) and navigate back (the action bar has defaulted to blue during the page transition)

Expected:

The navigation bar (ActionBar) not to change the styles when back navigation is triggered. The issue happens on iOS only (works as expected on Android with slide transition)

Temporary solution:

Explicitly align the styles of ActionBar as done here and only then hide the action bar as done here

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

Successfully merging a pull request may close this issue.

3 participants