Add animation to modal based on button click?

#1

Hello everyone,

Right now I have a modal that is opened with a nice slide in transition. In the modal there is a toolbar that has a “back-arrow”. When you press the back-arrow the modal slides out from where it came :slight_smile:

Now, in the modal I have a save-button at the bottom to save changes. AND it feels only natural that the “leave animation” is the standard modal.dismiss() animation, where the modal just fades out downwards.

My question:
Can you dynamically change the “leave animation” of a modal? I would like to have one “leave animation” when the user presses “back” and the standard if you choose to save the information in the modal.

async openHanteraLicens(item: any) {
    this.licenserService.setRowClicked(item);
    const hanteraLicensModal = await this.modalController.create({
      component: HanteraLicensPage,
      componentProps: {
        item: item 
      },
      enterAnimation: mEnterAnimation,
      leaveAnimation: mLeaveAnimation
    });
    return await hanteraLicensModal.present(); 
  }