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

feat(action-bar): flat mode breaks ios safe area by MartoYankov · Pull Request #6862 · NativeScript/NativeScript · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .ts  (3) .xml  (12) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
10 changes: 10 additions & 0 deletions apps/app/ui-tests-app/action-bar/flat-scrollview.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd">

<ActionBar flat="true" backgroundColor="blue">
<Label text="flat action bar"></Label>
</ActionBar>

<ScrollView backgroundColor="green">
<Label text="lorem ipsum" backgroundColor="red"></Label>
</ScrollView>
</Page>
14 changes: 14 additions & 0 deletions apps/app/ui-tests-app/action-bar/flat-tab.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd">

<ActionBar flat="true">
<Label text="flat action bar"></Label>
</ActionBar>

<TabView selectedTabTextColor="green">
<TabViewItem title="First">
<GridLayout backgroundColor="red">
<Button text="test" backgroundColor="yellow"></Button>
</GridLayout>
</TabViewItem>
</TabView>
</Page>
2 changes: 2 additions & 0 deletions apps/app/ui-tests-app/action-bar/main-page.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export function loadExamples() {
examples.set("modalHiddenActBar", "action-bar/modal-test-hidden-action-bar");
examples.set("modalShownActBar", "action-bar/modal-test-with-action-bar");
examples.set("flat", "action-bar/flat");
examples.set("flat-tab", "action-bar/flat-tab");
examples.set("flat-scrollview", "action-bar/flat-scrollview");

return examples;
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" actionBarHidden="true">

<ActionBar>
<Label text="Parent page"></Label>
</ActionBar>

<GridLayout backgroundColor="blue">
<Frame id="nestedFrame" defaultPage="ui-tests-app/nested-frames/nested-page-flat" actionBarVisibility="always"></Frame>
</GridLayout>
</Page>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd">

<ActionBar flat="true">
<Label text="Parent page flat action bar"></Label>
</ActionBar>

<GridLayout backgroundColor="blue">
<Frame id="nestedFrame" defaultPage="ui-tests-app/nested-frames/nested-page" actionBarVisibility="never"></Frame>
</GridLayout>
</Page>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd">

<ActionBar flat="true">
<Label text="Parent page flat action bar"></Label>
</ActionBar>

<GridLayout backgroundColor="blue">
<Frame id="nestedFrame" defaultPage="ui-tests-app/nested-frames/nested-page-flat" actionBarVisibility="always"></Frame>
</GridLayout>
</Page>
9 changes: 9 additions & 0 deletions apps/app/ui-tests-app/nested-frames/main-page.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,24 @@ export function loadExamples() {
const examples = new Map<string, string>();
examples.set("full-screen-n-n", "nested-frames/full-screen-n-n");
examples.set("full-screen-n-y", "nested-frames/full-screen-n-y");
examples.set("full-screen-n-y-flat", "nested-frames/full-screen-n-y-flat");
examples.set("full-screen-y-n", "nested-frames/full-screen-y-n");
examples.set("full-screen-y-n-flat", "nested-frames/full-screen-y-n-flat");
examples.set("full-screen-y-y", "nested-frames/full-screen-y-y");
examples.set("full-screen-y-y-flat", "nested-frames/full-screen-y-y-flat");
examples.set("mid-screen-n-n", "nested-frames/mid-screen-n-n");
examples.set("mid-screen-n-y", "nested-frames/mid-screen-n-y");
examples.set("mid-screen-n-y-flat", "nested-frames/mid-screen-n-y-flat");
examples.set("mid-screen-y-n", "nested-frames/mid-screen-y-n");
examples.set("mid-screen-y-n-flat", "nested-frames/mid-screen-y-n-flat");
examples.set("mid-screen-y-y", "nested-frames/mid-screen-y-y");
examples.set("mid-screen-y-y-flat", "nested-frames/mid-screen-y-y-flat");
examples.set("tab-y-y", "nested-frames/tab-y-y");
examples.set("tab-y-y-flat", "nested-frames/tab-y-y-flat");
examples.set("tab-n-y", "nested-frames/tab-n-y");
examples.set("tab-n-y-flat", "nested-frames/tab-n-y-flat");
examples.set("tab-y-n", "nested-frames/tab-y-n");
examples.set("tab-y-n-flat", "nested-frames/tab-y-n-flat");
examples.set("tab-n-n", "nested-frames/tab-n-n");

return examples;
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" actionBarHidden="true">

<ActionBar>
<Label text="Parent page"></Label>
</ActionBar>

<GridLayout rows="200, *" backgroundColor="blue">
<GridLayout row="1">
<Frame id="nestedFrame" defaultPage="ui-tests-app/nested-frames/nested-page-flat" actionBarVisibility="always"></Frame>
</GridLayout>>
</GridLayout>
</Page>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd">

<ActionBar flat="true">
<Label text="Parent page flat action bar"></Label>
</ActionBar>

<GridLayout rows="200, *" backgroundColor="blue">
<GridLayout row="1">
<Frame id="nestedFrame" defaultPage="ui-tests-app/nested-frames/nested-page" actionBarVisibility="never"></Frame>
</GridLayout>>
</GridLayout>
</Page>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd">

<ActionBar flat="true">
<Label text="Parent page flat action bar"></Label>
</ActionBar>

<GridLayout rows="200, *" backgroundColor="blue">
<GridLayout row="1">
<Frame id="nestedFrame" defaultPage="ui-tests-app/nested-frames/nested-page-flat" actionBarVisibility="always"></Frame>
</GridLayout>>
</GridLayout>
</Page>
13 changes: 13 additions & 0 deletions apps/app/ui-tests-app/nested-frames/nested-page-flat.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd">

<ActionBar flat="true">
<Label text="Nested page flat action bar"></Label>
</ActionBar>

<GridLayout rows="*, *" columns="*, *" backgroundColor="red">
<Label row="0" col="0" text="test" backgroundColor="gold"></Label>
<Label row="0" col="1" text="test" backgroundColor="green"></Label>
<Label row="1" col="0" text="test" backgroundColor="yellow"></Label>
<Label row="1" col="1" text="test" backgroundColor="purple"></Label>
</GridLayout>
</Page>
14 changes: 14 additions & 0 deletions apps/app/ui-tests-app/nested-frames/tab-n-y-flat.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" actionBarHidden="true">

<ActionBar>
<Label text="Parent page"></Label>
</ActionBar>

<TabView selectedTabTextColor="green">
<TabViewItem title="First">
<GridLayout>
<Frame id="nestedFrame" defaultPage="ui-tests-app/nested-frames/nested-page-flat" actionBarVisibility="always"></Frame>
</GridLayout>
</TabViewItem>
</TabView>
</Page>
14 changes: 14 additions & 0 deletions apps/app/ui-tests-app/nested-frames/tab-y-n-flat.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd">

<ActionBar flat="true">
<Label text="Parent page flat action bar"></Label>
</ActionBar>

<TabView selectedTabTextColor="green">
<TabViewItem title="First">
<GridLayout>
<Frame id="nestedFrame" defaultPage="ui-tests-app/nested-frames/nested-page" actionBarVisibility="never"></Frame>
</GridLayout>
</TabViewItem>
</TabView>
</Page>
14 changes: 14 additions & 0 deletions apps/app/ui-tests-app/nested-frames/tab-y-y-flat.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd">

<ActionBar flat="true">
<Label text="Parent page flat action bar"></Label>
</ActionBar>

<TabView selectedTabTextColor="green">
<TabViewItem title="First">
<GridLayout>
<Frame id="nestedFrame" defaultPage="ui-tests-app/nested-frames/nested-page-flat" actionBarVisibility="always"></Frame>
</GridLayout>
</TabViewItem>
</TabView>
</Page>
11 changes: 8 additions & 3 deletions tns-core-modules/ui/page/page.ios.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,14 @@ class UIViewControllerImpl extends UIViewController {
}

if (frameParent) {
const parentPageInsetsTop = frameParent.nativeViewProtected.safeAreaInsets.top;
const currentInsetsTop = this.view.safeAreaInsets.top;
const additionalInsetsTop = Math.max(parentPageInsetsTop - currentInsetsTop, 0);
let additionalInsetsTop = 0;

// if current page has flat action bar, inherited top insets should be ignored.
if (!owner.actionBar.flat) {
const parentPageInsetsTop = frameParent.nativeViewProtected.safeAreaInsets.top;
const currentInsetsTop = this.view.safeAreaInsets.top;
additionalInsetsTop = Math.max(parentPageInsetsTop - currentInsetsTop, 0);
}

const parentPageInsetsBottom = frameParent.nativeViewProtected.safeAreaInsets.bottom;
const currentInsetsBottom = this.view.safeAreaInsets.bottom;
Expand Down

Back | FazBrowse Home | New Git URL