mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(ios): opaque bars break ui layout (#6929)
* fix(ios): opaque bars break ui layout * test(): change flat action bar tests * test(): revert test flat change test
This commit is contained in:
@@ -93,27 +93,13 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
equal(insets.top, topInset, `${layout}.topInset - actual:${insets.top}; expected: ${topInset}`)
|
||||
}
|
||||
|
||||
private layout_insets_top_action_bar_flat_test(layout: view.View) {
|
||||
const insets = layout.getSafeAreaInsets();
|
||||
equal(insets.top, 0, `${layout}.topInset - actual:${insets.top}; expected: ${0}`)
|
||||
}
|
||||
|
||||
private layout_in_full_screen_test(layout: view.View, pageOptions?: helper.PageOptions) {
|
||||
let expectedTop = 0;
|
||||
if (pageOptions && (pageOptions.actionBarFlat)) {
|
||||
const app = iosUtils.getter(UIApplication, UIApplication.sharedApplication);
|
||||
const statusBarHeight = round(dipToDp(app.statusBarFrame.size.height));
|
||||
const actionBarHeight = round(dipToDp(layout.page.actionBar.nativeViewProtected.frame.size.height));
|
||||
|
||||
expectedTop = statusBarHeight + actionBarHeight;
|
||||
}
|
||||
|
||||
const l = left(layout);
|
||||
const t = top(layout);
|
||||
const r = right(layout);
|
||||
const b = bottom(layout);
|
||||
equal(l, 0, `${layout}.left - actual:${l}; expected: ${0}`);
|
||||
equal(t, expectedTop, `${layout}.top - actual:${t}; expected: ${expectedTop}`);
|
||||
equal(t, 0, `${layout}.top - actual:${t}; expected: ${0}`);
|
||||
equal(r, platform.screen.mainScreen.widthPixels, `${layout}.right - actual:${r}; expected: ${platform.screen.mainScreen.widthPixels}`);
|
||||
equal(b, platform.screen.mainScreen.heightPixels, `${layout}.bottom - actual:${b}; expected: ${platform.screen.mainScreen.heightPixels}`);
|
||||
}
|
||||
@@ -193,7 +179,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
this.getViews(snippet),
|
||||
this.noop,
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_flat_test(root);
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBarFlat: true }
|
||||
);
|
||||
@@ -391,7 +377,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
this.getViews(snippet),
|
||||
this.noop,
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_flat_test(root);
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBarFlat: true }
|
||||
);
|
||||
@@ -609,7 +595,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
this.getViews(snippet),
|
||||
this.noop,
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_flat_test(root);
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBarFlat: true }
|
||||
);
|
||||
@@ -903,7 +889,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
this.getViews(snippet),
|
||||
this.noop,
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_flat_test(root);
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBarFlat: true }
|
||||
);
|
||||
@@ -1140,7 +1126,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
this.getViews(snippet),
|
||||
this.noop,
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_flat_test(root);
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBarFlat: true }
|
||||
);
|
||||
@@ -1354,7 +1340,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
this.getViews(snippet),
|
||||
this.noop,
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_flat_test(root);
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBarFlat: true }
|
||||
);
|
||||
|
||||
@@ -47,20 +47,12 @@ export class ListViewSafeAreaTest extends UITest<ListView> {
|
||||
};
|
||||
|
||||
private list_view_in_full_screen(listView: ListView, pageOptions?: helper.PageOptions) {
|
||||
let expectedTop = 0;
|
||||
if (pageOptions && pageOptions.actionBarFlat) {
|
||||
const actionBarHeight = round(dipToDp(listView.page.actionBar.nativeViewProtected.frame.size.height));
|
||||
const app = iosUtils.getter(UIApplication, UIApplication.sharedApplication);
|
||||
const statusBarHeight = round(dipToDp(app.statusBarFrame.size.height));
|
||||
expectedTop = actionBarHeight + statusBarHeight;
|
||||
}
|
||||
|
||||
const l = left(listView);
|
||||
const t = top(listView);
|
||||
const r = right(listView);
|
||||
const b = bottom(listView);
|
||||
equal(l, 0, `${listView}.left - actual:${l}; expected: ${0}`);
|
||||
equal(t, expectedTop, `${listView}.top - actual:${t}; expected: ${expectedTop}`);
|
||||
equal(t, 0, `${listView}.top - actual:${t}; expected: ${0}`);
|
||||
equal(r, platform.screen.mainScreen.widthPixels, `${listView}.right - actual:${r}; expected: ${platform.screen.mainScreen.widthPixels}`);
|
||||
equal(b, platform.screen.mainScreen.heightPixels, `${listView}.bottom - actual:${b}; expected: ${platform.screen.mainScreen.heightPixels}`);
|
||||
}
|
||||
|
||||
@@ -41,20 +41,12 @@ export class RepeaterSafeAreaTest extends UITest<Repeater> {
|
||||
};
|
||||
|
||||
private repeater_in_full_screen(repeater: Repeater, pageOptions?: helper.PageOptions) {
|
||||
let expectedTop = 0;
|
||||
if (pageOptions && pageOptions.actionBarFlat) {
|
||||
const actionBarHeight = round(dipToDp(repeater.page.actionBar.nativeViewProtected.frame.size.height));
|
||||
const app = iosUtils.getter(UIApplication, UIApplication.sharedApplication);
|
||||
const statusBarHeight = round(dipToDp(app.statusBarFrame.size.height));
|
||||
expectedTop = actionBarHeight + statusBarHeight;
|
||||
}
|
||||
|
||||
const l = left(repeater);
|
||||
const t = top(repeater);
|
||||
const r = right(repeater);
|
||||
const b = bottom(repeater);
|
||||
equal(l, 0, `${repeater}.left - actual:${l}; expected: ${0}`);
|
||||
equal(t, expectedTop, `${repeater}.top - actual:${t}; expected: ${expectedTop}`);
|
||||
equal(t, 0, `${repeater}.top - actual:${t}; expected: ${0}`);
|
||||
equal(r, platform.screen.mainScreen.widthPixels, `${repeater}.right - actual:${r}; expected: ${platform.screen.mainScreen.widthPixels}`);
|
||||
equal(b, platform.screen.mainScreen.heightPixels, `${repeater}.bottom - actual:${b}; expected: ${platform.screen.mainScreen.heightPixels}`);
|
||||
}
|
||||
|
||||
@@ -51,20 +51,12 @@ class ScrollLayoutSafeAreaTest extends UITest<ScrollView> {
|
||||
};
|
||||
|
||||
private scroll_view_in_full_screen(scrollView: view.View, pageOptions?: helper.PageOptions) {
|
||||
let expectedTop = 0;
|
||||
if (pageOptions && pageOptions.actionBarFlat) {
|
||||
const actionBarHeight = round(dipToDp(scrollView.page.actionBar.nativeViewProtected.frame.size.height));
|
||||
const app = iosUtils.getter(UIApplication, UIApplication.sharedApplication);
|
||||
const statusBarHeight = round(dipToDp(app.statusBarFrame.size.height));
|
||||
expectedTop = actionBarHeight + statusBarHeight;
|
||||
}
|
||||
|
||||
const l = left(scrollView);
|
||||
const t = top(scrollView);
|
||||
const r = right(scrollView);
|
||||
const b = bottom(scrollView);
|
||||
equal(l, 0, `${scrollView}.left - actual:${l}; expected: ${0}`);
|
||||
equal(t, expectedTop, `${scrollView}.top - actual:${t}; expected: ${expectedTop}`);
|
||||
equal(t, 0, `${scrollView}.top - actual:${t}; expected: ${0}`);
|
||||
equal(r, platform.screen.mainScreen.widthPixels, `${scrollView}.right - actual:${r}; expected: ${platform.screen.mainScreen.widthPixels}`);
|
||||
equal(b, platform.screen.mainScreen.heightPixels, `${scrollView}.bottom - actual:${b}; expected: ${platform.screen.mainScreen.heightPixels}`);
|
||||
}
|
||||
|
||||
@@ -41,20 +41,12 @@ export class WebViewSafeAreaTest extends UITest<WebView> {
|
||||
};
|
||||
|
||||
private webview_in_full_screen(webView: WebView, pageOptions?: helper.PageOptions) {
|
||||
let expectedTop = 0;
|
||||
if (pageOptions && pageOptions.actionBarFlat) {
|
||||
const actionBarHeight = round(dipToDp(webView.page.actionBar.nativeViewProtected.frame.size.height));
|
||||
const app = iosUtils.getter(UIApplication, UIApplication.sharedApplication);
|
||||
const statusBarHeight = round(dipToDp(app.statusBarFrame.size.height));
|
||||
expectedTop = actionBarHeight + statusBarHeight;
|
||||
}
|
||||
|
||||
const l = left(webView);
|
||||
const t = top(webView);
|
||||
const r = right(webView);
|
||||
const b = bottom(webView);
|
||||
equal(l, 0, `${webView}.left - actual:${l}; expected: ${0}`);
|
||||
equal(t, expectedTop, `${webView}.top - actual:${t}; expected: ${expectedTop}`);
|
||||
equal(t, 0, `${webView}.top - actual:${t}; expected: ${0}`);
|
||||
equal(r, platform.screen.mainScreen.widthPixels, `${webView}.right - actual:${r}; expected: ${platform.screen.mainScreen.widthPixels}`);
|
||||
equal(b, platform.screen.mainScreen.heightPixels, `${webView}.bottom - actual:${b}; expected: ${platform.screen.mainScreen.heightPixels}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user