mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
fix(core): corrected Frame navigation event types (#10697)
This commit is contained in:

committed by
GitHub

parent
317b098321
commit
1b72912f81
@ -12,6 +12,7 @@ import { sanitizeModuleName } from '../../utils/common';
|
|||||||
import { profile } from '../../profiling';
|
import { profile } from '../../profiling';
|
||||||
import { FRAME_SYMBOL } from './frame-helpers';
|
import { FRAME_SYMBOL } from './frame-helpers';
|
||||||
import { SharedTransition } from '../transition/shared-transition';
|
import { SharedTransition } from '../transition/shared-transition';
|
||||||
|
import { NavigationData } from '.';
|
||||||
|
|
||||||
export { NavigationType } from './frame-interfaces';
|
export { NavigationType } from './frame-interfaces';
|
||||||
export type { AndroidActivityCallbacks, AndroidFragmentCallbacks, AndroidFrame, BackstackEntry, NavigationContext, NavigationEntry, NavigationTransition, TransitionState, ViewEntry, iOSFrame } from './frame-interfaces';
|
export type { AndroidActivityCallbacks, AndroidFragmentCallbacks, AndroidFrame, BackstackEntry, NavigationContext, NavigationEntry, NavigationTransition, TransitionState, ViewEntry, iOSFrame } from './frame-interfaces';
|
||||||
@ -256,6 +257,7 @@ export class FrameBase extends CustomLayoutView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setCurrent(entry: BackstackEntry, navigationType: NavigationType): void {
|
public setCurrent(entry: BackstackEntry, navigationType: NavigationType): void {
|
||||||
|
const fromEntry = this._currentEntry;
|
||||||
const newPage = entry.resolvedPage;
|
const newPage = entry.resolvedPage;
|
||||||
|
|
||||||
// In case we navigated forward to a page that was in the backstack
|
// In case we navigated forward to a page that was in the backstack
|
||||||
@ -274,11 +276,12 @@ export class FrameBase extends CustomLayoutView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newPage.onNavigatedTo(isBack);
|
newPage.onNavigatedTo(isBack);
|
||||||
this.notify({
|
this.notify<NavigationData>({
|
||||||
eventName: FrameBase.navigatedToEvent,
|
eventName: FrameBase.navigatedToEvent,
|
||||||
object: this,
|
object: this,
|
||||||
isBack,
|
isBack,
|
||||||
entry,
|
entry,
|
||||||
|
fromEntry,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Reset executing context after NavigatedTo is raised;
|
// Reset executing context after NavigatedTo is raised;
|
||||||
@ -478,7 +481,7 @@ export class FrameBase extends CustomLayoutView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
backstackEntry.resolvedPage.onNavigatingTo(backstackEntry.entry.context, isBack, backstackEntry.entry.bindingContext);
|
backstackEntry.resolvedPage.onNavigatingTo(backstackEntry.entry.context, isBack, backstackEntry.entry.bindingContext);
|
||||||
this.notify({
|
this.notify<NavigationData>({
|
||||||
eventName: FrameBase.navigatingToEvent,
|
eventName: FrameBase.navigatingToEvent,
|
||||||
object: this,
|
object: this,
|
||||||
isBack,
|
isBack,
|
||||||
|
4
packages/core/ui/frame/index.d.ts
vendored
4
packages/core/ui/frame/index.d.ts
vendored
@ -7,8 +7,8 @@ import { Transition } from '../transition';
|
|||||||
export * from './frame-interfaces';
|
export * from './frame-interfaces';
|
||||||
|
|
||||||
export interface NavigationData extends EventData {
|
export interface NavigationData extends EventData {
|
||||||
entry?: NavigationEntry;
|
entry?: BackstackEntry;
|
||||||
fromEntry?: NavigationEntry;
|
fromEntry?: BackstackEntry;
|
||||||
isBack?: boolean;
|
isBack?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user