textTransform, whiteSpace & textAlignment defaultValue is now “initia” (#3948)

removed enum namespaces
add valueConverter to clipToBounds
This commit is contained in:
Hristo Hristov
2017-04-06 09:50:37 +03:00
committed by GitHub
parent 2c74f93a44
commit f350f7191d
31 changed files with 368 additions and 644 deletions

View File

@@ -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);

View File

@@ -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>;