Skip to content

Commit 1b72912

Browse files
authored
fix(core): corrected Frame navigation event types (NativeScript#10697)
1 parent 317b098 commit 1b72912

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/core/ui/frame/frame-common.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { sanitizeModuleName } from '../../utils/common';
1212
import { profile } from '../../profiling';
1313
import { FRAME_SYMBOL } from './frame-helpers';
1414
import { SharedTransition } from '../transition/shared-transition';
15+
import { NavigationData } from '.';
1516

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

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

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

276278
newPage.onNavigatedTo(isBack);
277-
this.notify({
279+
this.notify<NavigationData>({
278280
eventName: FrameBase.navigatedToEvent,
279281
object: this,
280282
isBack,
281283
entry,
284+
fromEntry,
282285
});
283286

284287
// Reset executing context after NavigatedTo is raised;
@@ -478,7 +481,7 @@ export class FrameBase extends CustomLayoutView {
478481
}
479482

480483
backstackEntry.resolvedPage.onNavigatingTo(backstackEntry.entry.context, isBack, backstackEntry.entry.bindingContext);
481-
this.notify({
484+
this.notify<NavigationData>({
482485
eventName: FrameBase.navigatingToEvent,
483486
object: this,
484487
isBack,

packages/core/ui/frame/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { Transition } from '../transition';
77
export * from './frame-interfaces';
88

99
export interface NavigationData extends EventData {
10-
entry?: NavigationEntry;
11-
fromEntry?: NavigationEntry;
10+
entry?: BackstackEntry;
11+
fromEntry?: BackstackEntry;
1212
isBack?: boolean;
1313
}
1414

0 commit comments

Comments
 (0)