MCPcopy Create free account
hub / github.com/ionic-team/ionic-framework / beforeTransition

Function beforeTransition

core/src/utils/transition/index.ts:57–86  ·  view source on GitHub ↗
(opts: TransitionOptions, transitioningInactiveHeader: HTMLElement | null)

Source from the content-addressed store, hash-verified

55};
56
57const beforeTransition = (opts: TransitionOptions, transitioningInactiveHeader: HTMLElement | null) => {
58 const enteringEl = opts.enteringEl;
59 const leavingEl = opts.leavingEl;
60
61 focusController.saveViewFocus(leavingEl);
62
63 setZIndex(enteringEl, leavingEl, opts.direction);
64 // Prevent flickering of the header by adding a class.
65 setHeaderTransitionClass(transitioningInactiveHeader, true);
66
67 if (opts.showGoBack) {
68 enteringEl.classList.add('can-go-back');
69 } else {
70 enteringEl.classList.remove('can-go-back');
71 }
72 setPageHidden(enteringEl, false);
73
74 /**
75 * When transitioning, the page should not
76 * respond to click events. This resolves small
77 * issues like users double tapping the ion-back-button.
78 * These pointer events are removed in `afterTransition`.
79 */
80 enteringEl.style.setProperty('pointer-events', 'none');
81
82 if (leavingEl) {
83 setPageHidden(leavingEl, false);
84 leavingEl.style.setProperty('pointer-events', 'none');
85 }
86};
87
88const runTransition = async (opts: TransitionOptions): Promise<TransitionResult> => {
89 const animationBuilder = await getAnimationBuilder(opts);

Callers 1

transitionFunction · 0.85

Calls 4

setZIndexFunction · 0.85
setHeaderTransitionClassFunction · 0.85
setPageHiddenFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected