All Projects → shprink → Ionic Native Transitions

shprink / Ionic Native Transitions

Licence: other
[Maintenance only] Native transitions (iOS & Android) for Ionic Framework

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Ionic Native Transitions

Building A Complete Mobile App With Ionic Framework
JSConfUY 2015 Ionic workshop app. Ionic example conference app.
Stars: ✭ 89 (-84.89%)
Mutual labels:  ionic, ionic-framework, angularjs
ionic4-angular7-example
Ionic 4, Angular 7 and Cordova Tutorial: Build CRUD Mobile Apps
Stars: ✭ 57 (-90.32%)
Mutual labels:  angularjs, ionic, ionic-framework
ionic4-angular6-crud-example
Building CRUD Mobile App using Ionic 4, Angular 6 and Cordova
Stars: ✭ 50 (-91.51%)
Mutual labels:  angularjs, ionic, ionic-framework
fireblogger
Ionic 2 social media microblogging platform built with firebase 3 as backend
Stars: ✭ 54 (-90.83%)
Mutual labels:  ionic, ionic-framework
tutorial-photo-gallery-vue
Photo Gallery Tutorial: Ionic Vue and Capacitor
Stars: ✭ 33 (-94.4%)
Mutual labels:  ionic, ionic-framework
talks
Let's talk about ..
Stars: ✭ 13 (-97.79%)
Mutual labels:  ionic, ionic-framework
ionic-image-upload
Ionic Plugin for Uploading Images to Amazon S3
Stars: ✭ 26 (-95.59%)
Mutual labels:  ionic, ionic-framework
ionic-native-sms-retriever-plugin-master
Cross-platform plugin for Cordova / PhoneGap to Retrieve SMS. Available for Android.
Stars: ✭ 16 (-97.28%)
Mutual labels:  ionic, ionic-framework
ionic-custom-components
🌈 Ionic Tutorial: Mastering Web Components in Ionic Framework. This repo is an Ionic project showcasing Angular custom components and Stencil custom web components.
Stars: ✭ 30 (-94.91%)
Mutual labels:  ionic, ionic-framework
ionic-surveyjs
Sample project that shows how to integrate SurveyJS in Ionic APP.
Stars: ✭ 28 (-95.25%)
Mutual labels:  ionic, ionic-framework
ngx-ionic-image-viewer
An Ionic 4 Angular component to view & zoom on images and photos without any additional dependencies.
Stars: ✭ 129 (-78.1%)
Mutual labels:  ionic, ionic-framework
Ionic-ElastiChat-with-Images
Ionic Magic Chat with Angular Elastic, Autolinker.js and more!
Stars: ✭ 66 (-88.79%)
Mutual labels:  angularjs, ionic-framework
ionic-firebase-image-upload
Building an Ionic App with Protected/Private Content. This app shows how to use Firebase Storage from an Ionic Angular app both with public and private content.
Stars: ✭ 19 (-96.77%)
Mutual labels:  ionic, ionic-framework
keyonic-v2
A Keycloak Mobile Implementation using Angular v4 and Ionic v3
Stars: ✭ 23 (-96.1%)
Mutual labels:  ionic, ionic-framework
ionic-uber-clone
Ionic 4 Taxi Booking script
Stars: ✭ 34 (-94.23%)
Mutual labels:  ionic, ionic-framework
todo-list
TodoList using Ionic2/3 & Firebase: * PWA * SSO Google plus. * Share list via QRcode. * Upload image from Camera or Storage. * Speech Recognition.
Stars: ✭ 18 (-96.94%)
Mutual labels:  ionic, ionic-framework
ionic-signature-pad
Ionic plugin to input singnature pad
Stars: ✭ 15 (-97.45%)
Mutual labels:  ionic, ionic-framework
ionic-modal-custom-transitions
Add Custom Transitions to Ionic Modals.
Stars: ✭ 22 (-96.26%)
Mutual labels:  ionic, ionic-framework
ionic4-ngrx-firebase
A basic application for Ionic 4 with firebase & ngrx actions, reducers and effects
Stars: ✭ 17 (-97.11%)
Mutual labels:  ionic, ionic-framework
Mobile.UP
Mobile.UP
Stars: ✭ 13 (-97.79%)
Mutual labels:  angularjs, ionic

Native transitions for Ionic v1. Turn it on and enjoy native transitions!

gif

Please note that this project is now in maintenance mode. We welcome PRs for bug fixes, but encourage you to use Ionic 2 and Ionic Native for all future development.

Chat

Join the chat at https://gitter.im/shprink/ionic-native-transitions

Installation

npm

https://www.npmjs.com/package/ionic-native-transitions

npm install ionic-native-transitions --save

Then require the library

# ES5
require('ionic-native-transitions');

# or ES6
import 'ionic-native-transitions';

Bower

bower install shprink/ionic-native-transitions

Then insert the dist file

<script src="./PathToBowerLib/dist/ionic-native-transitions.min.js"></script>

Cordova/Ionic

The recommended version for the Transition plugin is 0.6.5 or higher.

# Using Cordova
cordova plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions#0.6.5

# Using Ionic CLI
ionic plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions#0.6.5

iOS

Transitions on iOS9 can flicker sometimes. To prevent this from hapenning you can install this plugin:

# Using Cordova
cordova plugin add cordova-plugin-wkwebview

# Using Ionic CLI
ionic plugin add cordova-plugin-wkwebview

Android

if you are using Crosswalk > 1.3 please add the following to your config.xml

<preference name="CrosswalkAnimatable" value="true" />

Configuration

angular.module('yourApp', [
    'ionic-native-transitions'
]);

Set default options (optional)

Beware: Only use setDefaultOptions if you know what you are doing.

.config(function($ionicNativeTransitionsProvider){
    $ionicNativeTransitionsProvider.setDefaultOptions({
        duration: 400, // in milliseconds (ms), default 400,
        slowdownfactor: 4, // overlap views (higher number is more) or no overlap (1), default 4
        iosdelay: -1, // ms to wait for the iOS webview to update before animation kicks in, default -1
        androiddelay: -1, // same as above but for Android, default -1
        winphonedelay: -1, // same as above but for Windows Phone, default -1,
        fixedPixelsTop: 0, // the number of pixels of your fixed header, default 0 (iOS and Android)
        fixedPixelsBottom: 0, // the number of pixels of your fixed footer (f.i. a tab bar), default 0 (iOS and Android)
        triggerTransitionEvent: '$ionicView.afterEnter', // internal ionic-native-transitions option
        backInOppositeDirection: false // Takes over default back transition and state back transition to use the opposite direction transition to go back
    });
});

Set default transition (optional)

See the list of possible transitions

.config(function($ionicNativeTransitionsProvider){
    $ionicNativeTransitionsProvider.setDefaultTransition({
        type: 'slide',
        direction: 'left'
    });
});

Set default back transition (optional)

See the list of possible transitions

.config(function($ionicNativeTransitionsProvider){
    $ionicNativeTransitionsProvider.setDefaultBackTransition({
        type: 'slide',
        direction: 'right'
    });
});

Enable/Disable (optional)

You can programatically disable the plugin for any reason:

# Within the config phase
# * @param {boolean} enabled
$ionicNativeTransitionsProvider.enable(false);

# Anywhere else (controller, service etc.)
# * @param {boolean} enabled                    default true
# * @param {boolean} disableIonicTransitions    default true
# * @param {string}  ionicTransitionType        default 'platform'

# Disable plugin and enable ionic transitions (same as: enable(false, false))
$ionicNativeTransitions.enable(false);

# Enable plugin and disable ionic transitions (same as: enable(true, true))
$ionicNativeTransitions.enable(true);

# Disable plugin and disable ionic transitions
$ionicNativeTransitions.enable(false, true);

# Enable plugin and enable ionic transitions
# in some cases it is useful <https://github.com/shprink/ionic-native-transitions/issues/23>
$ionicNativeTransitions.enable(true, false);

Usage

By default any state transition will use the default transition (Defined in the configuration phase) but you can specify a different transition per state if you want using the UI router state definition:

.state('home', {
    url: '/home',
    nativeTransitions: {
        "type": "flip",
        "direction": "up"
    }
    templateUrl: "templates/home.html"
})

You can also define a different transition (backward and forward) per device like this:

.state('home', {
    url: '/home',
    nativeTransitionsAndroid: {
        "type": "flip",
        "direction": "right"
    },
    nativeTransitionsIOS: {
        "type": "flip",
        "direction": "left"
    },
    nativeTransitionsWindowsPhone: {
        "type": "flip",
        "direction": "down"
    },
    nativeTransitionsBackAndroid: {
        "type": "flip",
        "direction": "left"
    },
    nativeTransitionsBackIOS: {
        "type": "flip",
        "direction": "right"
    },
    nativeTransitionsBackWindowsPhone: {
        "type": "flip",
        "direction": "up"
    },
    templateUrl: "templates/home.html"
})

Overwrite just one device (here only android will be different)

.state('home', {
    url: '/home',
    nativeTransitions: {
        "type": "flip",
        "direction": "up"
    },
    nativeTransitionsAndroid: {
        "type": "flip",
        "direction": "right"
    }
    templateUrl: "templates/home.html"
})

Disable native transition for one state (for instance on tabs)

.state('home', {
    url: '/home',
    nativeTransitions: null,
    templateUrl: "templates/home.html"
})

Programatically change page with native transitions

State

# * @description
# * Call state go and apply a native transition
# * @param {string|null} state                default:null
# * @param {object}      stateParams          default:{}
# * @param {object}      stateOptions         default:{}
# * @param {object|null} transitionOptions    default:null

$ionicNativeTransitions.stateGo('yourState', {}, {}, {
    "type": "slide",
    "direction": "up", // 'left|right|up|down', default 'left' (which is like 'next')
    "duration": 1500, // in milliseconds (ms), default 400
});

Location.url

# * @description
# * Call location url and apply a native transition
# * @param {string|null} url                 default:null
# * @param {object|null} transitionOptions   default:null

$ionicNativeTransitions.locationUrl('/yourUrl', {
    "type": "slide",
    "direction": "down", // 'left|right|up|down', default 'left' (which is like 'next')
    "duration": 1500, // in milliseconds (ms), default 400
});

Using directives

<button native-ui-sref="tabs.home({param1: 'param1', param2: 'param2'})" native-ui-sref-opts="{reload: true}" native-options="{type: 'slide', direction:'down'}"></button>

History back button

Using the <ion-nav-back-button> directive automatically uses the default back transition if you have not added a specific ng-click on it.

Hadware back button (Android)

The hardware back button on Android uses the default back transition

Swipe back (iOS)

For now swipe back will trigger the state native transition (or the default). It does not use the back transition.

You can disable swipe back like this:

$ionicConfigProvider.views.swipeBackEnabled(false);

Events

You can listen to success or error events

$rootScope.$on('ionicNativeTransitions.beforeTransition', function(){
    // Transition is about to happen
});

$rootScope.$on('ionicNativeTransitions.success', function(){
    // Transition success
});

$rootScope.$on('ionicNativeTransitions.error', function(){
    // Transition error
});

Possible transitions

Slide (default animation)

{
    "type"          : "slide",
    "direction"     : "left", // 'left|right|up|down', default 'left' (which is like 'next')
    "duration"      :  500, // in milliseconds (ms), default 400
}

Flip

{
    "type"          : "flip",
    "direction"     : "up", // 'left|right|up|down', default 'right' (Android currently only supports left and right)
    "duration"      :  500, // in milliseconds (ms), default 400
}

Fade (iOS and Android only)

{
    "type"          : "fade",
    "duration"      :  500, // in milliseconds (ms), default 400
}

Drawer (iOS and Android only)

{
    "type"          : "drawer",
    "origin"        : "left", // 'left|right', open the drawer from this side of the view, default 'left'
    "action"        : "open", // 'open|close', default 'open', note that close is not behaving nicely on Crosswalk
 }

Curl (iOS only, direction up and down only)

{
    "type"          : "curl",
    "direction"     : "up", // 'up|down', default 'up'
}

FAQ

What's the best way to animate tabs?

Use fade transition

.state('tabs.contact', {
    url: "/contact",
    nativeTransitions: {
        type: "fade"
    }
})

if you to use slide, use it with the fixedPixelsTop option.

.state('tabs.contact', {
    url: "/contact",
    nativeTransitions: {
        type: "slide",
        direction: "left",
        fixedPixelsTop: 93
    }
})

Contribute

Development

npm install

# Open two terminals
# and run watch to build on the lib files changes
npm run watch

# in the other terminal run following to build the test page and the doc
npm start

Open http://localhost:8080

Tests on device

npm run platformAddAndroid
npm run platformAddIOS
npm run pluginAddAll

# run iOS devices
npm run runIosDevice

# run iOS devices
npm run runAndroid

Thanks

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].