UNPKG

@nativescript/core

Version:

A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.

91 lines 2.85 kB
var ScrollViewBase_1; import { ContentView } from '../content-view'; import { Property, makeParser, makeValidator } from '../core/properties'; import { CSSType } from '../core/view'; import { booleanConverter } from '../core/view-base'; import { CoreTypes } from '../../core-types'; let ScrollViewBase = ScrollViewBase_1 = class ScrollViewBase extends ContentView { constructor() { super(...arguments); this._scrollChangeCount = 0; } addEventListener(arg, callback, thisArg) { super.addEventListener(arg, callback, thisArg); if (arg === ScrollViewBase_1.scrollEvent) { this._scrollChangeCount++; if (this.nativeViewProtected) { this.attachNative(); } } } removeEventListener(arg, callback, thisArg) { super.removeEventListener(arg, callback, thisArg); if (arg === ScrollViewBase_1.scrollEvent) { if (this._scrollChangeCount > 0) { this._scrollChangeCount--; if (this.nativeViewProtected && this._scrollChangeCount === 0) { this.detachNative(); } } } } initNativeView() { super.initNativeView(); if (this._scrollChangeCount > 0) { this.attachNative(); } } disposeNativeView() { if (this._scrollChangeCount > 0) { this.detachNative(); } super.disposeNativeView(); } attachNative() { // } detachNative() { // } get horizontalOffset() { return 0; } get verticalOffset() { return 0; } get scrollableWidth() { return 0; } get scrollableHeight() { return 0; } }; ScrollViewBase.scrollEvent = 'scroll'; ScrollViewBase = ScrollViewBase_1 = __decorate([ CSSType('ScrollView') ], ScrollViewBase); export { ScrollViewBase }; const converter = makeParser(makeValidator(CoreTypes.Orientation.horizontal, CoreTypes.Orientation.vertical)); export const orientationProperty = new Property({ name: 'orientation', defaultValue: CoreTypes.Orientation.vertical, affectsLayout: true, valueChanged: (target, oldValue, newValue) => { target._onOrientationChanged(); }, valueConverter: converter, }); orientationProperty.register(ScrollViewBase); export const scrollBarIndicatorVisibleProperty = new Property({ name: 'scrollBarIndicatorVisible', defaultValue: true, valueConverter: booleanConverter, }); scrollBarIndicatorVisibleProperty.register(ScrollViewBase); export const isScrollEnabledProperty = new Property({ name: 'isScrollEnabled', defaultValue: true, valueConverter: booleanConverter, }); isScrollEnabledProperty.register(ScrollViewBase); //# sourceMappingURL=scroll-view-common.js.map