mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
* enable recycling of nativeView * backgroundInternal is reset if setting new value leads to background.isEmpty() == true. * android background.getDefault always return copy of the background. Now all controls that mutate the background can be reset to initial state (e.g. Button & ActionBar) passing resources to copied background so it respect density. fix properties initNativeView * reset padding when backgroundInternal is reset. * Fix text reset Fix padding reset * fix tsc errors * fix ugly text rendering. * Add unit tests for recycling native views Fix several issues that came from the above tests Fix maxLength property missing a converter callback Remove old files * Remove old files * Revert backgroundInternal setter * change the order of tests so that appium can work again * Remove suggestion on every TextView & TextField init (strangely it is enabled after view is recycled....) * Fix function to get parent layout if specified * Button stateListAnimator restored when button is recycled zIndex defaultValue is now undefined instead of NaN * revert zIndex.setNative to always clear stateListAnimator because it was breaking one UI test (setting value=0 was returning the previous stateListAnimator) * fix search-bar backgound-color recycling * Fix alignments setters * Fix imageView recycling Fix button recycling Fix edit-text recycling resetNativeView is called only if recycleNativeView flag is true * Fix incorrect merge * Fix text-view & text-field textTransform * Fix EditText text reset * Fix runtime crash on ARM emulator API 21 * Fix text-base minHeight. maxHeight reset Fix reset of isUserInteractionEnabled
120 lines
3.7 KiB
TypeScript
120 lines
3.7 KiB
TypeScript
import { Style as StyleDefinition } from ".";
|
|
import { Color } from "../../../color";
|
|
import { Font, FontStyle, FontWeight } from "../font";
|
|
import { Background } from "../background";
|
|
import { Length, PercentLength, ViewBase, BackgroundRepeat, Visibility, HorizontalAlignment, VerticalAlignment, dip } from "../../core/view";
|
|
import { Observable } from "../../../data/observable";
|
|
|
|
import {
|
|
FlexDirection, FlexWrap, JustifyContent, AlignItems, AlignContent,
|
|
Order, FlexGrow, FlexShrink, FlexWrapBefore, AlignSelf
|
|
} from "../../layouts/flexbox-layout";
|
|
|
|
import { TextAlignment, TextDecoration, TextTransform, WhiteSpace } from "../../text-base";
|
|
|
|
export class Style extends Observable implements StyleDefinition {
|
|
constructor(public view: ViewBase) {
|
|
super();
|
|
}
|
|
|
|
toString() {
|
|
return `${this.view}.style`;
|
|
}
|
|
|
|
public fontInternal: Font;
|
|
public backgroundInternal: Background;
|
|
|
|
public rotate: number;
|
|
public scaleX: number;
|
|
public scaleY: number;
|
|
public translateX: dip;
|
|
public translateY: dip;
|
|
|
|
public clipPath: string;
|
|
public color: Color;
|
|
public tintColor: Color;
|
|
public placeholderColor: Color;
|
|
|
|
public backgroundColor: Color;
|
|
public backgroundImage: string;
|
|
public backgroundRepeat: BackgroundRepeat;
|
|
public backgroundSize: string;
|
|
public backgroundPosition: string;
|
|
|
|
public borderColor: string | Color;
|
|
public borderTopColor: Color;
|
|
public borderRightColor: Color;
|
|
public borderBottomColor: Color;
|
|
public borderLeftColor: Color;
|
|
public borderWidth: string | Length;
|
|
public borderTopWidth: Length;
|
|
public borderRightWidth: Length;
|
|
public borderBottomWidth: Length;
|
|
public borderLeftWidth: Length;
|
|
public borderRadius: string | Length;
|
|
public borderTopLeftRadius: Length;
|
|
public borderTopRightRadius: Length;
|
|
public borderBottomRightRadius: Length;
|
|
public borderBottomLeftRadius: Length;
|
|
|
|
public fontSize: number;
|
|
public fontFamily: string;
|
|
public fontStyle: FontStyle;
|
|
public fontWeight: FontWeight;
|
|
public font: string;
|
|
|
|
public zIndex: number;
|
|
public opacity: number;
|
|
public visibility: Visibility;
|
|
|
|
public letterSpacing: number;
|
|
public textAlignment: TextAlignment;
|
|
public textDecoration: TextDecoration;
|
|
public textTransform: TextTransform;
|
|
public whiteSpace: WhiteSpace;
|
|
|
|
public minWidth: Length;
|
|
public minHeight: Length;
|
|
public width: PercentLength;
|
|
public height: PercentLength;
|
|
public margin: string | PercentLength;
|
|
public marginLeft: PercentLength;
|
|
public marginTop: PercentLength;
|
|
public marginRight: PercentLength;
|
|
public marginBottom: PercentLength;
|
|
public padding: string | Length;
|
|
public paddingLeft: Length;
|
|
public paddingTop: Length;
|
|
public paddingRight: Length;
|
|
public paddingBottom: Length;
|
|
public horizontalAlignment: HorizontalAlignment;
|
|
public verticalAlignment: VerticalAlignment;
|
|
|
|
// TabView-specific props
|
|
public tabTextColor: Color;
|
|
public tabBackgroundColor: Color;
|
|
public selectedTabTextColor: Color;
|
|
public androidSelectedTabHighlightColor: Color;
|
|
|
|
// ListView-specific props
|
|
public separatorColor: Color;
|
|
|
|
//SegmentedBar-specific props
|
|
public selectedBackgroundColor: Color;
|
|
|
|
// Page-specific props
|
|
public statusBarStyle: "light" | "dark";
|
|
public androidStatusBarBackground: Color;
|
|
|
|
//flexbox layout properties
|
|
public flexDirection: FlexDirection;
|
|
public flexWrap: FlexWrap;
|
|
public justifyContent: JustifyContent;
|
|
public alignItems: AlignItems;
|
|
public alignContent: AlignContent;
|
|
public order: Order;
|
|
public flexGrow: FlexGrow;
|
|
public flexShrink: FlexShrink;
|
|
public flexWrapBefore: FlexWrapBefore;
|
|
public alignSelf: AlignSelf;
|
|
} |