Skip to content

Default transition of Frame is not used when using NsRouterLink #1784

Closed
@flore2003

Description

@flore2003

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 5.3.1
  • Cross-platform modules: 5.3.1
  • Android Runtime: 5.3.1
  • iOS Runtime: 5.3.1
  • NativeScript-Angular: 5.3.1
  • Angular: 7.2.9

Describe the bug
When setting the static defaultTransition property on the Frame class, the transition is not used, when navigation is initiated by tapping on an nsRouterLink that does not specify any transition using the [transition] input.

To Reproduce
Set Frame.defaultTransition to any valid NavigationTransition object. Tap on a button that has a nsRouterLink directive with no explicitly set transition. The default transition is not applied to this navigation.

Expected behavior
The default transition specified by setting Frame.defaultTransition should be used when there is no explicitly set transition on an nsRouterLink.

Additional context
This is due to NsRouterLink returning an empty object for the transition in the getTransition method (https://github.com/NativeScript/nativescript-angular/blob/master/nativescript-angular/router/ns-router-link.ts#L117) when no transition is explicitly set. In this case, the transition input defaults to true, which leads the getTransition method to return an empty object for the transition property. As the Frame checks whether the transition property is undefined to decide whether to use the default transition, this leads to the default transition not being used.

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