mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Fix: ActionBar update in IOS with modal dialogs
This commit is contained in:
@ -18,6 +18,8 @@ export function pageLoaded(args: EventData) {
|
|||||||
examples.set("actionItemPosition", "action-bar/action-item-position");
|
examples.set("actionItemPosition", "action-bar/action-item-position");
|
||||||
examples.set("actBGCss", "action-bar/background-css");
|
examples.set("actBGCss", "action-bar/background-css");
|
||||||
examples.set("actTransparentBgCss", "action-bar/transparent-bg-css");
|
examples.set("actTransparentBgCss", "action-bar/transparent-bg-css");
|
||||||
|
examples.set("modalHiddenActBar", "action-bar/modal-test-hidden-action-bar");
|
||||||
|
examples.set("modalShownActBar", "action-bar/modal-test-with-action-bar");
|
||||||
|
|
||||||
let viewModel = new SubMainPageViewModel(wrapLayout, examples);
|
let viewModel = new SubMainPageViewModel(wrapLayout, examples);
|
||||||
page.bindingContext = viewModel;
|
page.bindingContext = viewModel;
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
import { ShownModallyData } from "tns-core-modules/ui/page";
|
||||||
|
|
||||||
|
let closeCallback: Function;
|
||||||
|
|
||||||
|
export function onShownModally(args: ShownModallyData) {
|
||||||
|
closeCallback = args.closeCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function onTap() {
|
||||||
|
closeCallback("sample text");
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
<Page showingModally="onShownModally" actionBarHidden="true">
|
||||||
|
<StackLayout id="layout" >
|
||||||
|
<Button text="Close" tap="onTap" />
|
||||||
|
</StackLayout>
|
||||||
|
</Page>
|
11
apps/app/ui-tests-app/action-bar/modal-page.ts
Normal file
11
apps/app/ui-tests-app/action-bar/modal-page.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { ShownModallyData } from "tns-core-modules/ui/page";
|
||||||
|
|
||||||
|
let closeCallback: Function;
|
||||||
|
|
||||||
|
export function onShownModally(args: ShownModallyData) {
|
||||||
|
closeCallback = args.closeCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function onTap() {
|
||||||
|
closeCallback("sample text");
|
||||||
|
}
|
5
apps/app/ui-tests-app/action-bar/modal-page.xml
Normal file
5
apps/app/ui-tests-app/action-bar/modal-page.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<Page showingModally="onShownModally">
|
||||||
|
<StackLayout id="layout" >
|
||||||
|
<Button text="Close" tap="onTap" />
|
||||||
|
</StackLayout>
|
||||||
|
</Page>
|
@ -0,0 +1,13 @@
|
|||||||
|
import { EventData } from "tns-core-modules/data/observable";
|
||||||
|
import { Page } from "tns-core-modules/ui/page";
|
||||||
|
import { topmost } from "tns-core-modules/ui/frame";
|
||||||
|
|
||||||
|
export function btnClick(args: EventData) {
|
||||||
|
(<Page>args.object).page.showModal("ui-tests-app/action-bar/modal-page", "", function (arg: string) {
|
||||||
|
// ...
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function btnBack(args: EventData) {
|
||||||
|
topmost().goBack();
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
<Page xmlns="http://schemas.nativescript.org/tns.xsd" actionBarHidden="true">
|
||||||
|
<StackLayout>
|
||||||
|
<button text="Open Modal" tap="btnClick" />
|
||||||
|
<button text="Go Back" tap="btnBack" />
|
||||||
|
</StackLayout>
|
||||||
|
</Page>
|
@ -0,0 +1,13 @@
|
|||||||
|
import { EventData } from "tns-core-modules/data/observable";
|
||||||
|
import { Page } from "tns-core-modules/ui/page";
|
||||||
|
import { topmost } from "tns-core-modules/ui/frame";
|
||||||
|
|
||||||
|
export function btnClick(args: EventData) {
|
||||||
|
(<Page>args.object).page.showModal("ui-tests-app/action-bar/modal-page-hidden-action-bar", "", function (arg: string) {
|
||||||
|
// ...
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function btnBack(args: EventData) {
|
||||||
|
topmost().goBack();
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
<Page xmlns="http://schemas.nativescript.org/tns.xsd">
|
||||||
|
<Page.actionBar>
|
||||||
|
<ActionBar backgroundColor="green" title="Main View" icon="">
|
||||||
|
<NavigationButton text="Back" icon="" tap="" />
|
||||||
|
<ActionBar.actionItems>
|
||||||
|
<ActionItem icon="" text="Left" tap="" ios.position="left" />
|
||||||
|
<ActionItem icon="" text="Right" tap="" ios.position="right" />
|
||||||
|
</ActionBar.actionItems>
|
||||||
|
</ActionBar>
|
||||||
|
</Page.actionBar>
|
||||||
|
<StackLayout>
|
||||||
|
<button text="Open Modal" tap="btnClick" />
|
||||||
|
<button text="Go Back" tap="btnBack" />
|
||||||
|
</StackLayout>
|
||||||
|
</Page>
|
@ -45,7 +45,7 @@ export class Frame extends FrameBase {
|
|||||||
super();
|
super();
|
||||||
this._ios = new iOSFrame(this);
|
this._ios = new iOSFrame(this);
|
||||||
this.nativeView = this._ios.controller.view;
|
this.nativeView = this._ios.controller.view;
|
||||||
|
|
||||||
// When there is a 40px high "in-call" status bar, nobody moves the navigationBar top from 20 to 40 and it remains underneath the status bar.
|
// When there is a 40px high "in-call" status bar, nobody moves the navigationBar top from 20 to 40 and it remains underneath the status bar.
|
||||||
let frameRef = new WeakRef(this);
|
let frameRef = new WeakRef(this);
|
||||||
application.ios.addNotificationObserver(UIApplicationDidChangeStatusBarFrameNotification, (notification: NSNotification) => {
|
application.ios.addNotificationObserver(UIApplicationDidChangeStatusBarFrameNotification, (notification: NSNotification) => {
|
||||||
@ -202,6 +202,10 @@ export class Frame extends FrameBase {
|
|||||||
|
|
||||||
super._updateActionBar(page);
|
super._updateActionBar(page);
|
||||||
|
|
||||||
|
if (page && this.currentPage && this.currentPage.modal === page) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
page = page || this.currentPage;
|
page = page || this.currentPage;
|
||||||
let newValue = this._getNavBarVisible(page);
|
let newValue = this._getNavBarVisible(page);
|
||||||
let disableNavBarAnimationCache = this._ios._disableNavBarAnimation;
|
let disableNavBarAnimationCache = this._ios._disableNavBarAnimation;
|
||||||
|
Reference in New Issue
Block a user