mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
refactor(transition): remove navBar.transition config
This commit is contained in:
8
js/angular/controller/navBarController.js
vendored
8
js/angular/controller/navBarController.js
vendored
@@ -32,7 +32,7 @@ function($scope, $element, $attrs, $compile, $timeout, $ionicNavBarDelegate, $io
|
||||
|
||||
self.init = function() {
|
||||
$element.addClass('nav-bar-container');
|
||||
ionic.DomUtil.cachedAttr($element, 'nav-bar-transition', $ionicConfig.navBar.transition());
|
||||
ionic.DomUtil.cachedAttr($element, 'nav-bar-transition', $ionicConfig.views.transition());
|
||||
|
||||
// create two nav bar blocks which will trade out which one is shown
|
||||
self.createHeaderBar(false);
|
||||
@@ -195,7 +195,7 @@ function($scope, $element, $attrs, $compile, $timeout, $ionicNavBarDelegate, $io
|
||||
|
||||
self.update = function(viewData) {
|
||||
var showNavBar = !viewData.hasHeaderBar && viewData.showNavBar;
|
||||
viewData.transition = $ionicConfig.navBar.transition();
|
||||
viewData.transition = $ionicConfig.views.transition();
|
||||
|
||||
if (!showNavBar) {
|
||||
viewData.direction = 'none';
|
||||
@@ -229,14 +229,14 @@ function($scope, $element, $attrs, $compile, $timeout, $ionicNavBarDelegate, $io
|
||||
|
||||
self.transition = function(enteringHeaderBar, leavingHeaderBar, viewData) {
|
||||
var enteringHeaderBarCtrl = enteringHeaderBar.controller();
|
||||
var transitionFn = $ionicConfig.transitions.navBar[$ionicConfig.navBar.transition()];
|
||||
var transitionFn = $ionicConfig.transitions.navBar[viewData.transition];
|
||||
var transitionId = viewData.transitionId;
|
||||
|
||||
enteringHeaderBarCtrl.beforeEnter(viewData);
|
||||
|
||||
var navBarTransition = transitionFn(enteringHeaderBar, leavingHeaderBar, viewData.direction, viewData.shouldAnimate && self.isInitialized);
|
||||
|
||||
ionic.DomUtil.cachedAttr($element, 'nav-bar-transition', $ionicConfig.navBar.transition());
|
||||
ionic.DomUtil.cachedAttr($element, 'nav-bar-transition', viewData.transition);
|
||||
ionic.DomUtil.cachedAttr($element, 'nav-bar-direction', viewData.direction);
|
||||
|
||||
if (navBarTransition.shouldAnimate) {
|
||||
|
||||
34
js/angular/service/ionicConfig.js
vendored
34
js/angular/service/ionicConfig.js
vendored
@@ -153,15 +153,12 @@ IonicModule
|
||||
views: {
|
||||
maxCache: PLATFORM,
|
||||
forwardCache: PLATFORM,
|
||||
transition: PLATFORM,
|
||||
transitionFn: PLATFORM
|
||||
transition: PLATFORM
|
||||
},
|
||||
navBar: {
|
||||
alignTitle: PLATFORM,
|
||||
positionPrimaryButtons: PLATFORM,
|
||||
positionSecondaryButtons: PLATFORM,
|
||||
transition: PLATFORM,
|
||||
transitionFn: PLATFORM
|
||||
positionSecondaryButtons: PLATFORM
|
||||
},
|
||||
backButton: {
|
||||
icon: PLATFORM,
|
||||
@@ -194,8 +191,7 @@ IonicModule
|
||||
navBar: {
|
||||
alignTitle: 'center',
|
||||
positionPrimaryButtons: 'left',
|
||||
positionSecondaryButtons: 'right',
|
||||
transition: 'ios'
|
||||
positionSecondaryButtons: 'right'
|
||||
},
|
||||
|
||||
backButton: {
|
||||
@@ -234,8 +230,7 @@ IonicModule
|
||||
navBar: {
|
||||
alignTitle: 'left',
|
||||
positionPrimaryButtons: 'right',
|
||||
positionSecondaryButtons: 'right',
|
||||
transition: 'android'
|
||||
positionSecondaryButtons: 'right'
|
||||
},
|
||||
|
||||
backButton: {
|
||||
@@ -383,6 +378,27 @@ IonicModule
|
||||
};
|
||||
|
||||
|
||||
// No Transition
|
||||
// -----------------------
|
||||
|
||||
provider.transitions.views.none = function(enteringEle, leavingEle) {
|
||||
return {
|
||||
run: function(step) {
|
||||
provider.transitions.views.android(enteringEle, leavingEle, false, false).run(step);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
provider.transitions.navBar.none = function(enteringHeaderBar, leavingHeaderBar) {
|
||||
return {
|
||||
run: function(step) {
|
||||
provider.transitions.navBar.ios(enteringHeaderBar, leavingHeaderBar, false, false).run(step);
|
||||
provider.transitions.navBar.android(enteringHeaderBar, leavingHeaderBar, false, false).run(step);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// private: used to set platform configs
|
||||
function setPlatformConfig(platformName, platformConfigs) {
|
||||
configProperties.platform[platformName] = platformConfigs;
|
||||
|
||||
@@ -60,6 +60,10 @@ $ios-transition-container-bg-color: #000 !default;
|
||||
}
|
||||
}
|
||||
|
||||
[nav-bar="cached"] {
|
||||
display: block;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +154,8 @@ $android-transition-timing-leaving: cubic-bezier(0.4, 0, 1, 1) !default
|
||||
// Transition Settings
|
||||
// -------------------------------
|
||||
|
||||
[nav-view="cached"] {
|
||||
[nav-view="cached"],
|
||||
[nav-bar="cached"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user