Skip to content

Swipe back navigation overrides ActionBar styles (iOS) #7430

Closed

Description

@mudlabs

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.

Activity

  1. mudlabs commented on Jul 1, 2019

    @mudlabs
    ContributorAuthor

    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.
  2. mudlabs commented on Jul 2, 2019

    @mudlabs
    ContributorAuthor

    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.

  3. NickIliev commented on Jan 10, 2020

    @NickIliev
    Contributor

    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

  4. self-assigned this
    on Jan 15, 2020
  5. removed their assignment
    on Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions