2017-03-20 16:38:14 -04:00
import { Injectable } from '@angular/core' ;
2017-04-27 00:36:12 -04:00
import { Plugin , Cordova , IonicNativePlugin } from '@ionic-native/core' ;
2016-12-06 09:52:39 -05:00
export interface NativeTransitionOptions {
direction? : string ;
duration? : number ;
slowdownfactor? : number ;
slidePixels? : number ;
iosdelay? : number ;
androiddelay? : number ;
winphonedelay? : number ;
fixedPixelsTop? : number ;
fixedPixelsBottom? : number ;
action? : string ;
origin? : string ;
href? : string ;
}
2016-08-27 02:02:13 -04:00
/**
2017-03-20 16:38:14 -04:00
* @name Native Page Transitions
2016-08-27 02:02:13 -04:00
* @description
* The Native Page Transitions plugin uses native hardware acceleration to animate your transitions between views. You have complete control over the type of transition, the duration, and direction.
*
* @usage
* ```
2017-03-20 16:38:14 -04:00
* import { NativePageTransitions, NativeTransitionOptions } from '@ionic-native/native-page-transitions';
*
* constructor(private nativePageTransitions: NativePageTransitions) { }
*
* ...
2016-08-27 02:02:13 -04:00
*
*
2017-03-29 18:56:15 -04:00
* // example of adding a transition when a page/modal closes
* ionViewWillLeave() {
*
* let options: NativeTransitionOptions = {
* direction: 'up',
* duration: 500,
* slowdownfactor: 3,
* slidePixels: 20,
* iosdelay: 100,
* androiddelay: 150,
* fixedPixelsTop: 0,
* fixedPixelsBottom: 60
* };
*
* this.nativePageTransitions.slide(options)
* .then(onSuccess)
* .catch(onError);
*
* }
*
*
* // example of adding a transition when pushing a new page
* openPage(page: any) {
*
* this.nativePageTransitions.slide(options);
* this.navCtrl.push(page);
*
* }
2016-08-27 02:02:13 -04:00
*
* ```
*/
@Plugin ( {
2016-10-27 12:48:50 -05:00
pluginName : 'NativePageTransitions' ,
2016-08-27 02:02:13 -04:00
plugin : 'com.telerik.plugins.nativepagetransitions' ,
pluginRef : 'plugins.nativepagetransitions' ,
repo : 'https://github.com/Telerik-Verified-Plugins/NativePageTransitions' ,
platforms : [ 'iOS' , 'Android' , 'Windows Phone' ]
} )
2017-03-20 16:38:14 -04:00
@Injectable ( )
2017-04-27 00:36:12 -04:00
export class NativePageTransitions extends IonicNativePlugin {
2016-08-27 02:02:13 -04:00
/**
* Perform a slide animation
2016-12-06 09:52:39 -05:00
* @param options {NativeTransitionOptions} Options for the transition
2016-11-29 16:40:50 -06:00
* @returns {Promise<any>}
2016-08-27 02:02:13 -04:00
*/
@Cordova ( )
2017-03-20 16:38:14 -04:00
slide ( options : NativeTransitionOptions ) : Promise < any > { return ; }
2016-08-27 02:02:13 -04:00
/**
* Perform a flip animation
2016-12-06 09:52:39 -05:00
* @param options {NativeTransitionOptions} Options for the transition
2016-11-29 16:40:50 -06:00
* @returns {Promise<any>}
2016-08-27 02:02:13 -04:00
*/
@Cordova ( )
2017-03-20 16:38:14 -04:00
flip ( options : NativeTransitionOptions ) : Promise < any > { return ; }
2016-08-27 02:02:13 -04:00
/**
* Perform a fade animation
2016-12-06 09:52:39 -05:00
* @param options {NativeTransitionOptions} Options for the transition
2016-11-29 16:40:50 -06:00
* @returns {Promise<any>}
2016-08-27 02:02:13 -04:00
*/
@Cordova ( { platforms : [ 'iOS' , 'Android' ] } )
2017-03-20 16:38:14 -04:00
fade ( options : NativeTransitionOptions ) : Promise < any > { return ; }
2016-08-27 02:02:13 -04:00
/**
* Perform a slide animation
2016-12-06 09:52:39 -05:00
* @param options {NativeTransitionOptions} Options for the transition
2016-11-29 16:40:50 -06:00
* @returns {Promise<any>}
2016-08-27 02:02:13 -04:00
*/
@Cordova ( { platforms : [ 'iOS' , 'Android' ] } )
2017-03-20 16:38:14 -04:00
drawer ( options : NativeTransitionOptions ) : Promise < any > { return ; }
2016-08-27 02:02:13 -04:00
/**
* Perform a slide animation
2016-12-06 09:52:39 -05:00
* @param options {NativeTransitionOptions} Options for the transition
2016-11-29 16:40:50 -06:00
* @returns {Promise<any>}
2016-08-27 02:02:13 -04:00
*/
@Cordova ( { platforms : [ 'iOS' ] } )
2017-03-20 16:38:14 -04:00
curl ( options : NativeTransitionOptions ) : Promise < any > { return ; }
2016-08-27 02:02:13 -04:00
}