Skip to content

chore(core): Corrected Frame navigation event types #10697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/core/ui/frame/frame-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { sanitizeModuleName } from '../../utils/common';
import { profile } from '../../profiling';
import { FRAME_SYMBOL } from './frame-helpers';
import { SharedTransition } from '../transition/shared-transition';
import { NavigationData } from '.';

export { NavigationType } from './frame-interfaces';
export type { AndroidActivityCallbacks, AndroidFragmentCallbacks, AndroidFrame, BackstackEntry, NavigationContext, NavigationEntry, NavigationTransition, TransitionState, ViewEntry, iOSFrame } from './frame-interfaces';
Expand Down Expand Up @@ -256,6 +257,7 @@ export class FrameBase extends CustomLayoutView {
}

public setCurrent(entry: BackstackEntry, navigationType: NavigationType): void {
const fromEntry = this._currentEntry;
const newPage = entry.resolvedPage;

// In case we navigated forward to a page that was in the backstack
Expand All @@ -274,11 +276,12 @@ export class FrameBase extends CustomLayoutView {
}

newPage.onNavigatedTo(isBack);
this.notify({
this.notify<NavigationData>({
eventName: FrameBase.navigatedToEvent,
object: this,
isBack,
entry,
fromEntry,
});

// Reset executing context after NavigatedTo is raised;
Expand Down Expand Up @@ -478,7 +481,7 @@ export class FrameBase extends CustomLayoutView {
}

backstackEntry.resolvedPage.onNavigatingTo(backstackEntry.entry.context, isBack, backstackEntry.entry.bindingContext);
this.notify({
this.notify<NavigationData>({
eventName: FrameBase.navigatingToEvent,
object: this,
isBack,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/ui/frame/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { Transition } from '../transition';
export * from './frame-interfaces';

export interface NavigationData extends EventData {
entry?: NavigationEntry;
fromEntry?: NavigationEntry;
entry?: BackstackEntry;
fromEntry?: BackstackEntry;
isBack?: boolean;
}

Expand Down
Loading