mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00

We want webpack's uglification to mangle function and class names but that's what the current implementation of the CSS in {N} relys on to get the CSS type for each view when targeted by CSS type selectors. The implementation is changed a little so now the CSS type can be set directly on the prototype of each View class or for TS, through decorator. BREAKING CHANGES: Extending classes requires marking the derived class with @CSSType The root classes are not marked with CSSType and classes derived from ViewBase and View will continue to work as expected. More concrete view classes (Button, Label, etc.) are marked with @CSSType now and store their cssType on the prototype suppressing the previous implementation that looked up the class function name. So clien classes that derive from one of our @CSSType decorated classes will now have to be marked with @CSSType.
14 lines
504 B
TypeScript
14 lines
504 B
TypeScript
import { Switch as SwitchDefinition } from ".";
|
|
import { View, Property, booleanConverter, CSSType } from "../core/view";
|
|
|
|
export * from "../core/view";
|
|
|
|
@CSSType("Switch")
|
|
export class SwitchBase extends View implements SwitchDefinition {
|
|
public checked: boolean;
|
|
}
|
|
|
|
SwitchBase.prototype.recycleNativeView = "auto";
|
|
|
|
export const checkedProperty = new Property<SwitchBase, boolean>({ name: "checked", defaultValue: false, valueConverter: booleanConverter });
|
|
checkedProperty.register(SwitchBase); |