Transition ios default duration


#1

Hi all,

Can someone PLEASE let me know how to set a default duration for ios transitions?

I know I can add it to the navController on each link, but I would like it to be a default for all.

Thank you


#2

You could try filing a feature request to have it added to Config, but it looks hardcoded to 500 at the moment to me.


#3

Wow quick reply! Thanks, will do


#4

Actually I’ve found a way…

New file custom-transition.ts

import { IOSTransition } from 'ionic-angular/transitions/transition-ios';

export class IOSCustomTransition extends IOSTransition {

    init() {

        if (this.opts.duration === undefined || this.opts.duration === 0) {
            this.opts.duration = 300;
        }

        super.init();

    }
}

in the app.module.ts

export class AppModule {

    constructor(public config: Config) {
        
        this.config.setTransition('ios-transition', IOSCustomTransition);
    }

}

#5

Glad that’s working for you, but the older I get, the less I like inheritance.