How to use the @nativescript/core/ui/frame.Frame.topmost function in @nativescript/core

To help you get started, we’ve selected a few @nativescript/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NativeScript / NativeScript / tests / app / ui / frame / frame-tests-common.ts View on Github external
export function ignore_test_DummyTestForSnippetOnly4() {
    // >> frame-back
    const frame = Frame.topmost();
    frame.goBack();
    // << frame-back
}
github NativeScript / NativeScript / tests / app / test-runner.ts View on Github external
function showReportPage(finalMessage: string) {
    const stack = new StackLayout();
    const btn = new Button();
    btn.text = "Rerun tests";
    btn.on("tap", () => runAll(testsSelector));
    stack.addChild(btn);

    const messageContainer = new TextView();
    messageContainer.editable = messageContainer.autocorrect = false;
    messageContainer.text = finalMessage;
    stack.addChild(messageContainer);

    Frame.topmost().navigate({
        create: () => {
            const page = new Page();
            page.content = stack;
            messageContainer.focus();
            page.style.fontSize = 11;
            if (platform.isAndroid) {
                page.on('navigatedTo', () => {
                    messageContainer.focus();
                    setTimeout(() => messageContainer.dismissSoftInput());
                });
            }

            return page;
        },
        clearHistory: true
    });
github NativeScript / NativeScript / tests / app / ui-helper.ts View on Github external
export function getCurrentPage(): Page {
    return Frame.topmost().currentPage;
}
github NativeScript / NativeScript / tests / app / ui-helper.ts View on Github external
    waitUntilNavigatedFrom(() => topFrame ? topFrame.navigate(entry) : Frame.topmost().navigate(entry));
github NativeScript / NativeScript / tests / app / ui-helper.ts View on Github external
export function waitUntilNavigatedFrom(action: Function, topFrame?: Frame) {
    const currentPage = topFrame ? topFrame.currentPage : Frame.topmost().currentPage;
    let completed = false;
    function navigatedFrom(args) {
        args.object.page.off("navigatedFrom", navigatedFrom);
        completed = true;
    }

    currentPage.on("navigatedFrom", navigatedFrom);
    action();
    TKUnit.waitUntilReady(() => completed);
}
github NativeScript / NativeScript / tests / app / ui / frame / frame-tests-common.ts View on Github external
export function test_page_parent_when_navigate_with_clear_history() {
    const frame = Frame.topmost();

    const pages = new Array();
    const create = () => {
        const page = new Page();
        pages.push(page);

        return page;
    };

    frame.navigate({ create });
    frame.navigate({ create, backstackVisible: false });
    frame.navigate({ create });
    frame.navigate({ create: () => new Page(), clearHistory: true });
    emptyNavigationQueue(frame);

    TKUnit.assertEqual(pages.length, 3);
github NativeScript / NativeScript / tests / app / pages / page16.ts View on Github external
btn2.on("tap", () => {
        var nextPage = "app/tests/pages/page16";
        Frame.topmost().navigate(nextPage);
    });
github NativeScript / NativeScript / tests / app / ui / frame / frame-tests-common.ts View on Github external
export function test_page_parent_when_backstackVisible_is_false() {
    const frame = Frame.topmost();

    const pages = new Array();
    const create = () => {
        const page = new Page();
        pages.push(page);

        return page;
    };

    frame.navigate({ create: () => new Page(), clearHistory: true });
    frame.navigate({ create, backstackVisible: false });
    frame.navigate(() => new Page());
    emptyNavigationQueue(frame);

    TKUnit.assertEqual(pages.length, 1);
    TKUnit.assertEqual(frame.backStack.length, 1);