Fix: refresh flat property on change in IOS (#4628)

* Fix: refresh flat property on change in IOS

* Fix typos
This commit is contained in:
Alexander Vakrilov
2017-08-01 10:40:51 +03:00
committed by SvetoslavTsenov
parent d949cc7128
commit 2dbd1b19ea
3 changed files with 21 additions and 12 deletions

View File

@@ -1,15 +1,17 @@
import { Label } from "tns-core-modules/ui/Label"; import { Label } from "tns-core-modules/ui/label";
import { Page } from "tns-core-modules/ui/Page"; import { Page } from "tns-core-modules/ui/page";
export function onNavigateTo(args) { export function onNavigateTo(args) {
const actionBar = (<Page>args.object).actionBar; updateText(args.object);
args.object.flatPropertyValue = <Label>args.object.getViewById("flatPropertyValue");
actionBar.flat = true;
args.object.flatPropertyValue.text = "Action bar flat property is set to: " + actionBar.flat;
} }
export function changeFlatPropertyValue(args) { export function changeFlatPropertyValue(args) {
const actionBar = (<Page>args.object.page).actionBar; const page = <Page>args.object.page;
actionBar.flat = !actionBar.flat; page.actionBar.flat = !page.actionBar.flat;
args.object.page.flatPropertyValue.text = "Action bar flat property is set to: " + actionBar.flat; updateText(page);
}
function updateText(page: Page) {
const label = <Label>page.getViewById("flatPropertyValue");
label.text = "Action bar flat property is set to: " + page.actionBar.flat;
} }

View File

@@ -1,5 +1,5 @@
import { IOSActionItemSettings, ActionItem as ActionItemDefinition } from "."; import { IOSActionItemSettings, ActionItem as ActionItemDefinition } from ".";
import { ActionItemBase, ActionBarBase, isVisible, View, colorProperty, backgroundColorProperty, backgroundInternalProperty, layout, Color } from "./action-bar-common"; import { ActionItemBase, ActionBarBase, isVisible, View, colorProperty, backgroundColorProperty, backgroundInternalProperty, flatProperty, layout, Color } from "./action-bar-common";
import { ImageSource, fromFileOrResource } from "../../image-source"; import { ImageSource, fromFileOrResource } from "../../image-source";
export * from "./action-bar-common"; export * from "./action-bar-common";
@@ -359,4 +359,11 @@ export class ActionBar extends ActionBarBase {
} }
[backgroundInternalProperty.setNative](value: UIColor) { // tslint:disable-line [backgroundInternalProperty.setNative](value: UIColor) { // tslint:disable-line
} }
[flatProperty.setNative](value: boolean) { // tslint:disable-line
let navBar = this.navBar;
if (navBar) {
this.updateFlatness(navBar);
}
}
} }