mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(frame): rework frame retrieval api (#5527)
Rework the frame api to support working with multiple Frames. * frameModule.topmost() - now returns the last navigated Frame or the currently selected tab item's Frame if the tab item's view is a Frame. * frameModule.getFrameById(id: string) - returns a navigated Frame by id. * args.object.page.frame - can be used in page elements event handlers. Returns the Frame of the current element's page. * chore: Update madge-android npm script path
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
import { textTransformProperty, TextTransform, getTransformedText } from "../text-base";
|
||||
import { fromFileOrResource } from "../../image-source";
|
||||
import { RESOURCE_PREFIX, ad } from "../../utils/utils";
|
||||
import { Frame } from "../frame";
|
||||
|
||||
export * from "./tab-view-common";
|
||||
|
||||
@@ -473,6 +474,12 @@ export class TabView extends TabViewBase {
|
||||
}
|
||||
});
|
||||
|
||||
const newItem = items[newIndex];
|
||||
const selectedView = newItem && newItem.view;
|
||||
if (selectedView instanceof Frame) {
|
||||
selectedView._pushInFrameStack();
|
||||
}
|
||||
|
||||
toLoad.forEach(index => {
|
||||
const item = items[index];
|
||||
if (this.isLoaded && items[index]) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import { Page } from "../page";
|
||||
import { profile } from "../../profiling";
|
||||
import * as uiUtils from "../utils";
|
||||
import * as utils from "../../utils/utils";
|
||||
import { Frame } from "../frame";
|
||||
|
||||
export * from "./tab-view-common";
|
||||
|
||||
@@ -253,6 +254,11 @@ export class TabView extends TabViewBase {
|
||||
|
||||
const newItem = items[newIndex];
|
||||
if (newItem && this.isLoaded) {
|
||||
const selectedView = items[newIndex].view;
|
||||
if (selectedView instanceof Frame) {
|
||||
selectedView._pushInFrameStack();
|
||||
}
|
||||
|
||||
newItem.loadView(newItem.view);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user