mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
26 lines
715 B
TypeScript
26 lines
715 B
TypeScript
import { Button as ButtonDefinition } from '.';
|
|
import { TextBase } from '../text-base';
|
|
import { CSSType } from '../core/view';
|
|
import { booleanConverter } from '../core/view-base';
|
|
import { AccessibilityRole } from '../../accessibility';
|
|
|
|
@CSSType('Button')
|
|
export abstract class ButtonBase extends TextBase implements ButtonDefinition {
|
|
public static tapEvent = 'tap';
|
|
|
|
accessibilityRole = AccessibilityRole.Button;
|
|
|
|
get textWrap(): boolean {
|
|
return this.style.whiteSpace === 'normal';
|
|
}
|
|
set textWrap(value: boolean) {
|
|
if (typeof value === 'string') {
|
|
value = booleanConverter(value);
|
|
}
|
|
|
|
this.style.whiteSpace = value ? 'normal' : 'nowrap';
|
|
}
|
|
}
|
|
|
|
ButtonBase.prototype.recycleNativeView = 'auto';
|