UNPKG

@nativescript-rtl/ui

Version:

Add right-to-left support to NativeScript framework

58 lines 1.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.directionProperty = exports.isRtlProperty = exports.Common = void 0; const grid_layout_1 = require("@nativescript/core/ui/layouts/grid-layout"); const ui_1 = require("@nativescript/core/ui"); class Common extends grid_layout_1.GridLayout { constructor() { super(...arguments); this._directionScheduled = false; } scheduleDirectionUpdate() { if (this._directionScheduled) { return; } this._directionScheduled = true; setTimeout(() => { this._directionScheduled = false; if (!this.nativeViewProtected) { return; } this._updateDirection(); }); } _updateDirection() { } ; } exports.Common = Common; exports.isRtlProperty = new ui_1.Property({ name: "isRtl", defaultValue: true, valueConverter(v) { let lowercase = (v + "").toLowerCase(); if (lowercase === "true") { return true; } else if (lowercase === "false") { return false; } throw new Error("Invalid boolean: " + v); } }); exports.isRtlProperty.register(Common); exports.directionProperty = new ui_1.CssProperty({ name: "direction", cssName: "direction", defaultValue: "rtl", affectsLayout: true, valueConverter: (value) => { const val = value.toLocaleLowerCase(); if (val === "rtl" || val === "ltr") { return val; } throw new Error("Invalid string: " + val); } }); exports.directionProperty.register(ui_1.Style); //# sourceMappingURL=grid-layout.common.js.map