Skip to content

Instantly share code, notes, and snippets.

@ajoslin
Last active August 29, 2015 14:16
Show Gist options
  • Save ajoslin/ef744c0cdfc3d71377d3 to your computer and use it in GitHub Desktop.
Save ajoslin/ef744c0cdfc3d71377d3 to your computer and use it in GitHub Desktop.
/***************************
* IONIC INTERNAL CONFIG
***************************/
import {TabsConfig} from 'ionic/components/tabs';
function MaterialTabsMixin(tabsInstance) {
Pannable(tabsInstance);
return {
onPanStart() {},
onPan() {},
onPanEnd() {}
};
}
TabsConfig.platform('android')
.mixin(MaterialTabsMixin)
.set({ showStripe: true });
/***************************
* DEVELOPER'S CONFIG
***************************/
// When 'superAnimation' is set in config, use my mixin on tabs
TabsConfig.when('superAnimation').mixin(superAnimationMixin);
// Always show the material design stripe on large screens, no matter the platform.
TabsConfig.media('lg').set({ showStripe: true })
<!-- plain config of instance -->
<ion-tabs [config]="{ showStripe: true }" />
<!-- Use the user-defined superAnimationMixin -->
<ion-tabs [config]="{ superAnimation: true }" />
<!-- Activate the user-defined superAnimation mixin on android -->
<ion-tabs [config-platform-android]="{ superAnimation: true }" />
<!-- show the stripe on these tabs on desktop -->
<ion-tabs [config-media-lg]="{ showStripe: true }" />
// This would imperatively activate the superAnimation mixin on android for this instance
myTabsInstance.$config.platform('android').set({
superAnimation: true
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment