Skip to content

Commit fcc515f

Browse files
manucorporatadamdbradley
authored andcommitted
fix(transition): ios-transition can be used in MD/WP
fixes #7171
1 parent 93616c4 commit fcc515f

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

src/components/nav/test/basic/app-module.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ export class FirstPage {
122122
}
123123

124124
pushPrimaryHeaderPage() {
125-
this.navCtrl.push(PrimaryHeaderPage).then(() => {}, (rejectReason: string) => {
125+
this.navCtrl.push(PrimaryHeaderPage, null, {
126+
animate: true,
127+
animation: 'ios-transition'
128+
}).then(() => { }, (rejectReason: string) => {
126129
});
127130
}
128131

@@ -132,12 +135,18 @@ export class FirstPage {
132135
}
133136

134137
pushFullPage() {
135-
this.navCtrl.push(FullPage, { id: 8675309, myData: [1, 2, 3, 4] }).catch(() => {
138+
this.navCtrl.push(FullPage, { id: 8675309, myData: [1, 2, 3, 4] }, {
139+
animate: true,
140+
animation: 'md-transition'
141+
}).catch(() => {
136142
});
137143
}
138144

139145
pushAnother() {
140-
this.navCtrl.push(AnotherPage).catch(() => {
146+
this.navCtrl.push(AnotherPage, null, {
147+
animate: true,
148+
animation: 'wp-transition'
149+
}).catch(() => {
141150
});
142151
}
143152

src/transitions/transition-ios.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { PageTransition } from './page-transition';
55
const DURATION = 500;
66
const EASING = 'cubic-bezier(0.36,0.66,0.04,1)';
77
const OPACITY = 'opacity';
8+
const TRANSFORM = 'transform';
89
const TRANSLATEX = 'translateX';
910
const OFF_RIGHT = '99.5%';
1011
const OFF_LEFT = '-33%';
@@ -139,7 +140,8 @@ export class IOSTransition extends PageTransition {
139140
// leaving content, forward direction
140141
leavingContent
141142
.fromTo(TRANSLATEX, CENTER, OFF_LEFT)
142-
.fromTo(OPACITY, 1, OFF_OPACITY);
143+
.fromTo(OPACITY, 1, OFF_OPACITY)
144+
.afterClearStyles([TRANSFORM, OPACITY]);
143145
}
144146

145147
if (leavingHasNavbar) {
@@ -173,7 +175,7 @@ export class IOSTransition extends PageTransition {
173175
// should just fade out, no sliding
174176
leavingNavbarBg
175177
.beforeClearStyles([TRANSLATEX])
176-
.fromTo('opacity', 0.99, 0);
178+
.fromTo(OPACITY, 0.99, 0);
177179

178180
} else {
179181
// leaving navbar, back direction, and there's no entering navbar
@@ -189,7 +191,13 @@ export class IOSTransition extends PageTransition {
189191

190192
} else {
191193
// leaving navbar, forward direction
192-
leavingTitle.fromTo(TRANSLATEX, CENTER, OFF_LEFT);
194+
leavingTitle
195+
.fromTo(TRANSLATEX, CENTER, OFF_LEFT)
196+
.afterClearStyles([TRANSFORM]);
197+
198+
leavingBackButton.afterClearStyles([OPACITY]);
199+
leavingTitle.afterClearStyles([OPACITY]);
200+
leavingNavbarItems.afterClearStyles([OPACITY]);
193201
}
194202
}
195203

src/transitions/transition-md.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export class MDTransition extends PageTransition {
2323
if (enteringView) {
2424
if (backDirection) {
2525
this.duration(isPresent(opts.duration) ? opts.duration : 200).easing('cubic-bezier(0.47,0,0.745,0.715)');
26-
this.enteringPage.beforeClearStyles([TRANSLATEY]);
2726

2827
} else {
2928
this.duration(isPresent(opts.duration) ? opts.duration : 280).easing('cubic-bezier(0.36,0.66,0.04,1)');

0 commit comments

Comments
 (0)