mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix: refresh flat property on change in IOS (#4628)
* Fix: refresh flat property on change in IOS * Fix typos
This commit is contained in:
committed by
SvetoslavTsenov
parent
d949cc7128
commit
2dbd1b19ea
@@ -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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<Page navigatedTo="onNavigateTo" >
|
<Page navigatedTo="onNavigateTo" >
|
||||||
<Page.actionBar>
|
<Page.actionBar>
|
||||||
<ActionBar title="Flat property" />
|
<ActionBar title="Flat property"/>
|
||||||
</Page.actionBar>
|
</Page.actionBar>
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<Button margin="30" text="change flat property" tap="changeFlatPropertyValue"/>
|
<Button margin="30" text="change flat property" tap="changeFlatPropertyValue"/>
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user