mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
feat(action-bar): iosLargeTitle and iosShadow attributes (#10694)
[skip ci]
This commit is contained in:
@ -18,6 +18,10 @@ export class ActionBarBase extends View implements ActionBarDefinition {
|
||||
public title: string;
|
||||
public flat: boolean;
|
||||
public iosIconRenderingMode: 'automatic' | 'alwaysOriginal' | 'alwaysTemplate';
|
||||
// prefer large titles
|
||||
public iosLargeTitle = false;
|
||||
// show bottom border shadow (always defaulted to true)
|
||||
public iosShadow = true;
|
||||
|
||||
public effectiveContentInsetLeft: number;
|
||||
public effectiveContentInsetRight: number;
|
||||
@ -387,6 +391,12 @@ function convertToContentInset(this: void, value: string | CoreTypes.LengthType)
|
||||
export const iosIconRenderingModeProperty = new Property<ActionBarBase, 'automatic' | 'alwaysOriginal' | 'alwaysTemplate'>({ name: 'iosIconRenderingMode', defaultValue: 'alwaysOriginal' });
|
||||
iosIconRenderingModeProperty.register(ActionBarBase);
|
||||
|
||||
export const iosLargeTitleProperty = new Property<ActionBarBase, boolean>({ name: 'iosLargeTitle', defaultValue: false, valueConverter: booleanConverter });
|
||||
iosLargeTitleProperty.register(ActionBarBase);
|
||||
|
||||
export const iosShadowProperty = new Property<ActionBarBase, boolean>({ name: 'iosShadow', defaultValue: true, valueConverter: booleanConverter });
|
||||
iosShadowProperty.register(ActionBarBase);
|
||||
|
||||
export const textProperty = new Property<ActionItemBase, string>({
|
||||
name: 'text',
|
||||
defaultValue: '',
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IOSActionItemSettings, ActionItem as ActionItemDefinition } from '.';
|
||||
import { ActionItemBase, ActionBarBase, isVisible, flatProperty, iosIconRenderingModeProperty, traceMissingIcon } from './action-bar-common';
|
||||
import { ActionItemBase, ActionBarBase, isVisible, flatProperty, iosIconRenderingModeProperty, traceMissingIcon, iosShadowProperty, iosLargeTitleProperty } from './action-bar-common';
|
||||
import { View } from '../core/view';
|
||||
import { Color } from '../../color';
|
||||
import { ios as iosBackground } from '../styling/background';
|
||||
@ -8,6 +8,7 @@ import { colorProperty, backgroundInternalProperty, backgroundColorProperty, bac
|
||||
import { ios as iosViewUtils } from '../utils';
|
||||
import { ImageSource } from '../../image-source';
|
||||
import { layout, iOSNativeHelper, isFontIconURI } from '../../utils';
|
||||
import { SDK_VERSION } from '../../utils/constants';
|
||||
import { accessibilityHintProperty, accessibilityLabelProperty, accessibilityLanguageProperty, accessibilityValueProperty } from '../../accessibility/accessibility-properties';
|
||||
|
||||
export * from './action-bar-common';
|
||||
@ -533,7 +534,7 @@ export class ActionBar extends ActionBarBase {
|
||||
if (navBar.standardAppearance) {
|
||||
// Not flat and never been set do nothing.
|
||||
const appearance = navBar.standardAppearance;
|
||||
appearance.shadowColor = UINavigationBarAppearance.new().shadowColor;
|
||||
appearance.shadowColor = this.iosShadow ? UINavigationBarAppearance.new().shadowColor : UIColor.clearColor;
|
||||
this._updateAppearance(navBar, appearance);
|
||||
}
|
||||
} else {
|
||||
@ -644,9 +645,8 @@ export class ActionBar extends ActionBarBase {
|
||||
[backgroundInternalProperty.getDefault](): UIColor {
|
||||
return null;
|
||||
}
|
||||
[backgroundInternalProperty.setNative](value: UIColor) {
|
||||
// tslint:disable-line
|
||||
}
|
||||
// @ts-ignore
|
||||
[backgroundInternalProperty.setNative](value: UIColor) {}
|
||||
|
||||
[flatProperty.setNative](value: boolean) {
|
||||
const navBar = this.navBar;
|
||||
@ -661,4 +661,13 @@ export class ActionBar extends ActionBarBase {
|
||||
[iosIconRenderingModeProperty.setNative](value: 'automatic' | 'alwaysOriginal' | 'alwaysTemplate') {
|
||||
this.update();
|
||||
}
|
||||
|
||||
[iosLargeTitleProperty.setNative](value: boolean) {
|
||||
if (!this.navBar) {
|
||||
return;
|
||||
}
|
||||
if (SDK_VERSION >= 11) {
|
||||
this.navBar.prefersLargeTitles = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ export interface AnimationDefinition {
|
||||
scale?: Pair;
|
||||
height?: CoreTypes.PercentLengthType | string;
|
||||
width?: CoreTypes.PercentLengthType | string;
|
||||
rotate?: Point3D;
|
||||
rotate?: number | Point3D;
|
||||
duration?: number;
|
||||
delay?: number;
|
||||
iterations?: number;
|
||||
|
Reference in New Issue
Block a user