mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
textTransform, whiteSpace & textAlignment defaultValue is now “initia” (#3948)
removed enum namespaces add valueConverter to clipToBounds
This commit is contained in:
@@ -1,22 +1,15 @@
|
||||
import { StackLayout as StackLayoutDefinition } from ".";
|
||||
import { LayoutBase, Property, isIOS } from "../layout-base";
|
||||
import { StackLayout as StackLayoutDefinition, Orientation } from ".";
|
||||
import { LayoutBase, Property, isIOS, makeValidator, makeParser } from "../layout-base";
|
||||
|
||||
export * from "../layout-base";
|
||||
|
||||
export class StackLayoutBase extends LayoutBase implements StackLayoutDefinition {
|
||||
public orientation: "horizontal" | "vertical";
|
||||
public orientation: Orientation;
|
||||
}
|
||||
|
||||
// StackLayoutBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const orientationProperty = new Property<StackLayoutBase, "horizontal" | "vertical">({
|
||||
name: "orientation", defaultValue: "vertical", affectsLayout: isIOS,
|
||||
valueConverter: (v) => {
|
||||
if (v === "horizontal" || v === "vertical") {
|
||||
return <"horizontal" | "vertical">v;
|
||||
}
|
||||
const converter = makeParser<Orientation>(makeValidator("horizontal", "vertical"));
|
||||
|
||||
throw new Error(`Invalid orientation value: ${v}`);
|
||||
}
|
||||
});
|
||||
orientationProperty.register(StackLayoutBase);
|
||||
export const orientationProperty = new Property<StackLayoutBase, Orientation>({ name: "orientation", defaultValue: "vertical", affectsLayout: isIOS, valueConverter: converter });
|
||||
orientationProperty.register(StackLayoutBase);
|
||||
@@ -8,10 +8,12 @@ export class StackLayout extends LayoutBase {
|
||||
* Gets or sets if layout should be horizontal or vertical.
|
||||
* The default value is vertical.
|
||||
*/
|
||||
orientation: "horizontal" | "vertical";
|
||||
orientation: Orientation;
|
||||
}
|
||||
|
||||
export type Orientation = "horizontal" | "vertical";
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the orientation property of each StackLayout instance.
|
||||
*/
|
||||
export const orientationProperty: Property<StackLayout, "horizontal" | "vertical">;
|
||||
export const orientationProperty: Property<StackLayout, Orientation>;
|
||||
Reference in New Issue
Block a user