FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(ios): set current tab as topmost frame on load (#5908) · NativeScript/NativeScript@b122bd4 · GitHub

Commit b122bd4

Browse files
authored
fix(ios): set current tab as topmost frame on load (#5908)
1 parent 48a35c5 commit b122bd4

3 files changed

Lines changed: 30 additions & 4 deletions

File tree

‎tests/app/ui/tab-view/tab-view-root-tests.ts‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as helper from "../helper";
22
import TKUnit = require("../../TKUnit");
33
import { isIOS, isAndroid } from "tns-core-modules/platform";
44
import { _resetRootView } from "tns-core-modules/application/";
5-
import { Frame, NavigationEntry } from "tns-core-modules/ui/frame";
5+
import { Frame, NavigationEntry, topmost } from "tns-core-modules/ui/frame";
66
import { Page } from "tns-core-modules/ui/page";
77
import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view";
88

@@ -56,7 +56,26 @@ function createTabItemsWithFrames(count: number) {
5656
return items;
5757
}
5858

59-
export function test_ios_and_android_offset_zero_should_raise_same_events() {
59+
export function test_frame_topmost_matches_selectedIndex() {
60+
const items = createTabItemsWithFrames(3);
61+
const tabView = new TabView();
62+
tabView.items = items.map(item => item.tabItem);
63+
tabView.selectedIndex = 0;
64+
65+
const entry: NavigationEntry = {
66+
create: () => tabView
67+
};
68+
69+
helper.waitUntilNavigatedTo(items[0].page, () => _resetRootView(entry));
70+
71+
TKUnit.assertEqual(topmost().id, "Tab0 Frame0");
72+
73+
helper.waitUntilNavigatedTo(items[1].page, () => tabView.selectedIndex = 1);
74+
75+
TKUnit.assertEqual(topmost().id, "Tab1 Frame1");
76+
}
77+
78+
export function test_offset_zero_should_raise_same_events() {
6079
let actualEventsRaised = [];
6180

6281
function resetActualEventsRaised() {

‎tests/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"nativescript": {
77
"id": "org.nativescript.UnitTestApp",
88
"tns-ios": {
9-
"version": "3.4.1"
9+
"version": "4.1.0"
1010
},
1111
"tns-android": {
12-
"version": "3.4.1"
12+
"version": "4.1.1"
1313
}
1414
},
1515
"dependencies": {

‎tns-core-modules/ui/tab-view/tab-view.ios.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ export class TabView extends TabViewBase {
213213
@profile
214214
public onLoaded() {
215215
super.onLoaded();
216+
217+
const selectedIndex = this.selectedIndex;
218+
const selectedView = this.items && this.items[selectedIndex] && this.items[selectedIndex].view;
219+
if (selectedView instanceof Frame) {
220+
selectedView._pushInFrameStack();
221+
}
222+
216223
this._ios.delegate = this._delegate;
217224
}
218225

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL