import { TextBase, whiteSpaceProperty } from '../text-base';
import { profile } from '../../profiling';
import { CSSType } from '../core/view';
import { booleanConverter } from '../core/view-base';
import { CoreTypes } from '../../core-types';
export * from '../text-base';
let Label = class Label extends TextBase {
    get textWrap() {
        return this.style.whiteSpace === 'normal';
    }
    set textWrap(value) {
        if (typeof value === 'string') {
            value = booleanConverter(value);
        }
        this.style.whiteSpace = value ? 'normal' : 'nowrap';
    }
    createNativeView() {
        return new org.nativescript.widgets.StyleableTextView(this._context);
    }
    initNativeView() {
        const isRtl = this.direction === CoreTypes.LayoutDirection.rtl;
        super.initNativeView();
        const textView = this.nativeTextViewProtected;
        textView.setSingleLine(true);
        textView.setEllipsize(isRtl ? android.text.TextUtils.TruncateAt.START : android.text.TextUtils.TruncateAt.END);
        textView.setGravity(android.view.Gravity.CENTER_VERTICAL);
    }
    [whiteSpaceProperty.setNative](value) {
        // Label initial value is no-wrap. set in initNativeView
        const newValue = value === 'initial' ? 'nowrap' : value;
        super[whiteSpaceProperty.setNative](newValue);
    }
};
__decorate([
    profile,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], Label.prototype, "createNativeView", null);
Label = __decorate([
    CSSType('Label')
], Label);
export { Label };
Label.prototype._isSingleLine = true;
Label.prototype._isManualRtlTextStyleNeeded = true;
Label.prototype.recycleNativeView = 'auto';
//# sourceMappingURL=index.android.js.map