All Projects → WhatsThatItsPat → ionic-shrinkage

WhatsThatItsPat / ionic-shrinkage

Licence: ISC license
Directive for Ionic 2 to cause headers to shrink & reveal, in parallactic fashion, based on user scrolling.

Programming Languages

typescript
32286 projects

Labels

Projects that are alternatives of or similar to ionic-shrinkage

OneSignal-Ionic-Sample
No description or website provided.
Stars: ✭ 85 (+372.22%)
Mutual labels:  ionic
ionic4-angular7-httpinterceptor-example
Ionic 4 and Angular 7 Tutorial: HTTP Interceptor Example
Stars: ✭ 15 (-16.67%)
Mutual labels:  ionic
ionic-ecommerce
Ionic Ecommerce Frontend
Stars: ✭ 43 (+138.89%)
Mutual labels:  ionic
awesome-angular-iran
📄 A curated list of awesome Angular resources for Iranian developers
Stars: ✭ 25 (+38.89%)
Mutual labels:  ionic
sm-coal-app
这是一个使用Ionic2开发的集数据展示,交易,交流于一体的APP
Stars: ✭ 21 (+16.67%)
Mutual labels:  ionic
react-native-ionicons
Ionic icons for React Native
Stars: ✭ 43 (+138.89%)
Mutual labels:  ionic
ionic4-image-crop-upload
Ionic 4, Angular 7 and Cordova Crop and Upload Image
Stars: ✭ 16 (-11.11%)
Mutual labels:  ionic
ionic-login-component
Free sample of Premium Ionic Login Component
Stars: ✭ 17 (-5.56%)
Mutual labels:  ionic
cordova-plugin-exoplayer
Media player plugin for Cordova that uses Google's ExoPlayer
Stars: ✭ 48 (+166.67%)
Mutual labels:  ionic
ionic2-transparent-bar
A transparent bar DEMO in ionic2
Stars: ✭ 76 (+322.22%)
Mutual labels:  ionic
elearning
elearning linux/mac/db/cache/server/tools/人工智能
Stars: ✭ 72 (+300%)
Mutual labels:  ionic
ionic3-firebase-ngrx
Sample Ionic 3 application using ngrx with firebase (auth, crud and camera plugin)
Stars: ✭ 48 (+166.67%)
Mutual labels:  ionic
ionic-swing
[NOT MAINTAINED] A fork of swing.js and angular2-swing for Ionic without external hammerjs dependencies
Stars: ✭ 20 (+11.11%)
Mutual labels:  ionic
Food-Order
Food ordering template application using Ionic, Angular and Typescript.
Stars: ✭ 20 (+11.11%)
Mutual labels:  ionic
ionic-socialsharing-with-deeplinking-example
Ionic Social Sharing and Deep Linking example app. Complete Ionic Tutorial with free example app! Built for Ionic 3.
Stars: ✭ 16 (-11.11%)
Mutual labels:  ionic
docker-ionic-android-sdk
Docker image include android sdk for building ionic framework application
Stars: ✭ 40 (+122.22%)
Mutual labels:  ionic
bobbycar
IoT Transportation demo using Red Hat OpenShift and Middleware technologies
Stars: ✭ 33 (+83.33%)
Mutual labels:  ionic
ionic3-angular4-sample-app
Sample app of Ionic 3 and Angular 4
Stars: ✭ 35 (+94.44%)
Mutual labels:  ionic
ionic4-angular7-example
Ionic 4, Angular 7 and Cordova Tutorial: Build CRUD Mobile Apps
Stars: ✭ 57 (+216.67%)
Mutual labels:  ionic
app-starter
Angular mono-repo (Ionic/Capacitor/StencilJS/Web Component) app starter for supporting cross platform apps.
Stars: ✭ 75 (+316.67%)
Mutual labels:  ionic

ionic-shrinkage

ionic-shrinkage is a directive for Ionic 2 to cause headers to shrink & reveal, in parallactic fashion, based on user scrolling.

NOTE: This was built alongside Beta.11 of Ionic, and will be updated to Ionic 2.0 when it's final (or perhaps the release candidates, but we'll see).

I was in the pool

Installation

npm install ionic-shrinkage --save

Usage Example

home.ts

import { Component, ViewChild } from '@angular/core';
import { Content } from 'ionic-angular';
import { Shrinkage } from 'ionic-shrinkage';

@Component({
  templateUrl: 'build/pages/home/home.html',
  directives: [ Shrinkage ]
})
export class HomePage {
  // We bind content to the shrinkage attribute in the HTML template
  @ViewChild(Content) content: Content;

  // Necessary for the change() method below
  @ViewChild(Shrinkage) shrinkage;

  constructor() {}

  // If you use Structural Directives to add or remove items in the header,
  // you'll have to call resize() on both content and the shrinkage directive.
  change(e) {
    this.content.resize();
    this.shrinkage.resize();
  }
}

home.html

<ion-header [shrinkage]="content">

  <ion-navbar>
    <ion-title>I was in the pool!</ion-title>
  </ion-navbar>

  <!--Structural Directives need to be accounted for with the resize() method --> 
  <ion-toolbar no-border-top *ngIf="showSearch">
    <ion-searchbar></ion-searchbar>
  </ion-toolbar>

</ion-header>


<!--Note the fullscreen attribute-->
<ion-content class="home" fullscreen>

  <!--Enough content to scroll-->

  <ion-item>
    <ion-label>Search</ion-label>
    <!--change() will resize the content and header via the directive-->
    <ion-toggle [(ngModel)]="showSearch" (ionChange)="change()"></ion-toggle>
  </ion-item>

</ion-content>

Requirements & Notes

  • WKWebView - With UIWebView, scroll events don't continue firing after your finger has left the screen, and while scroll momentum is still in effect. This works in WKWebView.
  • Crosswalk - I looked at Android without Crosswalk for about 2 minutes and doubt I'll spent more that that.
  • Windows? - I don't know and haven't tested it at all.

TODO

  1. Resize method.
  2. Improve performance or provide fallback animation / cancellation for older devices.
    • Shrinkage works like butter on an iPhone 6s, but is janky on iPhone 5 and Galaxy S3 (with Crosswalk). Though both of those devices are from 2012, and possibly not worth fussing about.
    • Perfomance advice and device testing are welcome.
  3. Hide footers & tabs.
  4. Consider independently hiding toolbars within a header.

Author

Patrick McDonald (Github / Twitter)

Licence

This project is licensed under the ISC license. See the LICENSE file for more info.

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].