UNPKG

@nativescript-rtl/ui

Version:

Add right-to-left support to NativeScript framework

59 lines 1.96 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DockLayout = void 0; const dock_layout_common_1 = require("./dock-layout.common"); class DockLayout extends dock_layout_common_1.Common { initNativeView() { super.initNativeView(); this.scheduleDirectionUpdate(); } [dock_layout_common_1.isRtlProperty.setNative](isRtl) { this.isRtl = isRtl; this.scheduleDirectionUpdate(); } [dock_layout_common_1.directionProperty.setNative](direction) { if (direction === "rtl") { this.isRtl = true; } else if (direction === "ltr") { this.isRtl = false; } this.scheduleDirectionUpdate(); } addChild(view) { super.addChild(view); if (view.nativeViewProtected) { this.scheduleDirectionUpdate(); } } removeChild(view) { super.removeChild(view); if (view.nativeViewProtected) { this.scheduleDirectionUpdate(); } } _updateDirection() { if (this.isRtl) { this.nativeViewProtected.setRotationY(180); for (let viewIndex = 0; viewIndex < this["getChildrenCount"](); viewIndex++) { let NSView = this["getChildAt"](viewIndex); let isRtl = NSView["isRtl"] || false; if (isRtl) { NSView.nativeView.setRotationY(0); } else { NSView.nativeView.setRotationY(180); } } } else { this.nativeViewProtected.setRotationY(0); for (let viewIndex = 0; viewIndex < this["getChildrenCount"](); viewIndex++) { let NSView = this["getChildAt"](viewIndex); NSView.nativeView.setRotationY(0); } } } } exports.DockLayout = DockLayout; //# sourceMappingURL=dock-layout.android.js.map