Skip to content
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
27 changes: 27 additions & 0 deletions packages/core/ui/frame/frame-common.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,33 @@ describe('FrameBase.goBack', () => {

expect(frameStack).toEqual([only]);
});

it("navigates a nested frame with history when given the window's topmost frame", () => {
const window = createWindow('a');
const root = createFrameInWindow(window);
const nested = createFrame(true);
nested.parent = root;
nested._nativeWindow = window;
_pushInFrameStack(nested);

expect(FrameBase.goBack(FrameBase.topmost(window))).toBe(true);

expect(isNavigatingBack(nested)).toBe(true);
expect(isNavigatingBack(root)).toBe(false);
});

it('does not reach a nested frame with history when given its root frame', () => {
const window = createWindow('a');
const root = createFrameInWindow(window);
const nested = createFrame(true);
nested.parent = root;
nested._nativeWindow = window;
_pushInFrameStack(nested);

expect(FrameBase.goBack(root)).toBe(false);

expect(isNavigatingBack(nested)).toBe(false);
});
});

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/core/ui/frame/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ if (SDK_VERSION >= 33) {

// In the case of Frame, use this callback only if it was overridden, since the original will cause navigation issues
if (!viewArgs.cancel && (view.onBackPressed === Frame.prototype.onBackPressed || !view.onBackPressed())) {
callSuper = view instanceof Frame ? !Frame.goBack(view) : true;
callSuper = view instanceof Frame ? !Frame.goBack(Frame.topmost(nativeWindow)) : true;
}
}
}
Expand Down Expand Up @@ -1031,7 +1031,7 @@ export class ActivityCallbacksImplementation implements AndroidActivityCallbacks

// In the case of Frame, use this callback only if it was overridden, since the original will cause navigation issues
if (!viewArgs.cancel && (view.onBackPressed === Frame.prototype.onBackPressed || !view.onBackPressed())) {
callSuper = view instanceof Frame ? !Frame.goBack(view) : true;
callSuper = view instanceof Frame ? !Frame.goBack(Frame.topmost(nativeWindow)) : true;
}

if (callSuper) {
Expand Down
Loading