Skip to content

feat(nav-animations): export default ios and md transitions  #25243

Closed
@DwieDima

Description

@DwieDima

Prerequisites

Describe the Feature Request

The default page transitions for ios and md should be exposed to the developers so we can use them to create custom animations.

Describe the Use Case

I have a page transition, where the forward animation is just a fade-in effect. The back navigation should stay as it is (on ios transition from right to left).
Currently i have to inspect the ionic core code and paste the code to my method where i apply the animation.

    const enterAnimation = (baseEl: HTMLElement, opts: any): Animation => {
      if (opts.direction === 'forward') {
        return this.animationController
          .create()
          .addElement(opts.enteringEl)
          .duration(1000)
          .easing('ease-in')
          .fromTo('opacity', '0', '1');
      }
      // default ios back transition
      return null;
    };

Describe Preferred Solution

the ability to import the default ios transition to my page

  import { ..., iosTransitionAnimation } from '@ionic/core'

  private async navigateToPage(): Promise<void> {
    const enterAnimation = (baseEl: HTMLElement, opts: any): Animation => {
      if (opts.direction === 'forward') {
        return this.animationController
          .create()
          .addElement(opts.enteringEl)
          .duration(1000)
          .easing('ease-in')
          .fromTo('opacity', '0', '1');
      }
      // default ios back transition
      return iosTransitionAnimation.direction('reverse');
    };

    await this.ionNav.push(TransferPointsPage, null, {
      animationBuilder: enterAnimation,
    });
  }

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions