1 | var ScrollViewBase_1;
|
2 | import { ContentView } from '../content-view';
|
3 | import { Property, makeParser, makeValidator } from '../core/properties';
|
4 | import { CSSType } from '../core/view';
|
5 | import { booleanConverter } from '../core/view-base';
|
6 | import { CoreTypes } from '../../core-types';
|
7 | let ScrollViewBase = ScrollViewBase_1 = class ScrollViewBase extends ContentView {
|
8 | constructor() {
|
9 | super(...arguments);
|
10 | this._addedScrollEvent = false;
|
11 | }
|
12 | addEventListener(arg, callback, thisArg) {
|
13 | const hasExistingScrollListeners = this.hasListeners(ScrollViewBase_1.scrollEvent);
|
14 | super.addEventListener(arg, callback, thisArg);
|
15 |
|
16 | if (!hasExistingScrollListeners && this.hasListeners(ScrollViewBase_1.scrollEvent)) {
|
17 | this._addedScrollEvent = true;
|
18 | if (this.nativeViewProtected) {
|
19 | this.attachNative();
|
20 | }
|
21 | }
|
22 | }
|
23 | removeEventListener(arg, callback, thisArg) {
|
24 | const hasExistingScrollListeners = this.hasListeners(ScrollViewBase_1.scrollEvent);
|
25 | super.removeEventListener(arg, callback, thisArg);
|
26 |
|
27 | if (hasExistingScrollListeners && !this.hasListeners(ScrollViewBase_1.scrollEvent)) {
|
28 | this._addedScrollEvent = false;
|
29 | if (this.nativeViewProtected) {
|
30 | this.detachNative();
|
31 | }
|
32 | }
|
33 | }
|
34 | initNativeView() {
|
35 | super.initNativeView();
|
36 | if (this._addedScrollEvent) {
|
37 | this.attachNative();
|
38 | }
|
39 | }
|
40 | disposeNativeView() {
|
41 | if (this._addedScrollEvent) {
|
42 | this.detachNative();
|
43 | }
|
44 | super.disposeNativeView();
|
45 | }
|
46 | attachNative() {
|
47 |
|
48 | }
|
49 | detachNative() {
|
50 |
|
51 | }
|
52 | get horizontalOffset() {
|
53 | return 0;
|
54 | }
|
55 | get verticalOffset() {
|
56 | return 0;
|
57 | }
|
58 | get scrollableWidth() {
|
59 | return 0;
|
60 | }
|
61 | get scrollableHeight() {
|
62 | return 0;
|
63 | }
|
64 | };
|
65 | ScrollViewBase.scrollEvent = 'scroll';
|
66 | ScrollViewBase = ScrollViewBase_1 = __decorate([
|
67 | CSSType('ScrollView')
|
68 | ], ScrollViewBase);
|
69 | export { ScrollViewBase };
|
70 | const converter = makeParser(makeValidator(CoreTypes.Orientation.horizontal, CoreTypes.Orientation.vertical));
|
71 | export const orientationProperty = new Property({
|
72 | name: 'orientation',
|
73 | defaultValue: CoreTypes.Orientation.vertical,
|
74 | affectsLayout: true,
|
75 | valueChanged: (target, oldValue, newValue) => {
|
76 | target._onOrientationChanged();
|
77 | },
|
78 | valueConverter: converter,
|
79 | });
|
80 | orientationProperty.register(ScrollViewBase);
|
81 | export const scrollBarIndicatorVisibleProperty = new Property({
|
82 | name: 'scrollBarIndicatorVisible',
|
83 | defaultValue: true,
|
84 | valueConverter: booleanConverter,
|
85 | });
|
86 | scrollBarIndicatorVisibleProperty.register(ScrollViewBase);
|
87 | export const isScrollEnabledProperty = new Property({
|
88 | name: 'isScrollEnabled',
|
89 | defaultValue: true,
|
90 | valueConverter: booleanConverter,
|
91 | });
|
92 | isScrollEnabledProperty.register(ScrollViewBase);
|
93 |
|
\ | No newline at end of file |