1
- import { ChangeDetectionStrategy , Component , ElementRef , forwardRef , IterableDiffers , AfterContentInit , OnDestroy , NgZone } from '@angular/core' ;
2
- import { PickerField } from '@nativescript/picker' ;
3
- import { PickerValueAccessor } from './picker.accessors' ;
4
- import { View } from '@nativescript/core' ;
1
+ // import { ChangeDetectionStrategy, Component, ElementRef, forwardRef, IterableDiffers, AfterContentInit, OnDestroy, NgZone } from '@angular/core';
2
+ // import { PickerField } from '@nativescript/picker';
3
+ // import { PickerValueAccessor } from './picker.accessors';
4
+ // import { EventData, View } from '@nativescript/core';
5
5
6
- @Component ( {
7
- selector : 'PickerField' ,
8
- template : ` <DetachedContainer>
9
- <Placeholder #loader></Placeholder>
10
- </DetachedContainer>` ,
11
- changeDetection : ChangeDetectionStrategy . OnPush ,
12
- } )
13
- export class PickerFieldComponent implements AfterContentInit {
14
- private _className : string ;
6
+ // @Component ({
7
+ // selector: 'PickerField',
8
+ // template: ` <DetachedContainer>
9
+ // <Placeholder #loader></Placeholder>
10
+ // </DetachedContainer>`,
11
+ // changeDetection: ChangeDetectionStrategy.OnPush,
12
+ // })
13
+ // export class PickerFieldComponent implements AfterContentInit {
14
+ // private _className: string;
15
15
16
- public get nativeElement ( ) : PickerField {
17
- return this . templatedItemsView ;
18
- }
16
+ // public get nativeElement(): PickerField {
17
+ // return this.templatedItemsView;
18
+ // }
19
19
20
- public get className ( ) : string {
21
- return this . _className ;
22
- }
20
+ // public get className(): string {
21
+ // return this._className;
22
+ // }
23
23
24
- protected templatedItemsView : PickerField ;
24
+ // protected templatedItemsView: PickerField;
25
25
26
- constructor ( _elementRef : ElementRef , _iterableDiffers : IterableDiffers , _ngZone : NgZone ) {
27
-
28
- }
26
+ // constructor(_elementRef: ElementRef, _iterableDiffers: IterableDiffers, _ngZone: NgZone) {
27
+ // _elementRef.nativeElement.on('loaded', (ev: EventData) => {
28
+ // this.nativeElement.on('classNameChange', this.onClassNameChange.bind(this));
29
+ // });
30
+ // }
29
31
30
- ngAfterContentInit ( ) {
31
- this . nativeElement . on ( 'classNameChange' , this . onClassNameChange . bind ( this ) ) ;
32
- }
32
+ // ngOnDestroy() {
33
+ // if (this.nativeElement) {
34
+ // this.nativeElement.off('classNameChange', this.onClassNameChange.bind(this));
35
+ // }
36
+ // }
33
37
34
- ngOnDestroy ( ) {
35
- if ( this . nativeElement ) {
36
- this . nativeElement . off ( 'classNameChange' , this . onClassNameChange . bind ( this ) ) ;
37
- }
38
- }
38
+ // private onClassNameChange(args) {
39
+ // this._className = (<View>args.object).className;
40
+ // }
41
+ // }
39
42
40
- private onClassNameChange ( args ) {
41
- this . _className = ( < View > args . object ) . className ;
43
+
44
+
45
+
46
+ import { AfterContentInit , ChangeDetectionStrategy , Component , ElementRef , forwardRef , IterableDiffers , NgZone } from '@angular/core' ;
47
+ import { ListViewComponent , TEMPLATED_ITEMS_COMPONENT } from '@nativescript/angular' ;
48
+ import { PickerValueAccessor } from './picker.accessors' ;
49
+
50
+ @Component ( {
51
+ selector : 'PickerField' ,
52
+ template : `<DetachedContainer>
53
+ <ng-container #loader></ng-container>
54
+ </DetachedContainer>` ,
55
+ changeDetection : ChangeDetectionStrategy . OnPush ,
56
+ providers : [ { provide : TEMPLATED_ITEMS_COMPONENT , useExisting : forwardRef ( ( ) => PickerFieldComponent ) } ] ,
57
+ } )
58
+ export class PickerFieldComponent extends ListViewComponent implements AfterContentInit {
59
+ constructor ( _elementRef : ElementRef , _iterableDiffers : IterableDiffers , zone : NgZone ) {
60
+ super ( _elementRef , _iterableDiffers , zone ) ;
42
61
}
43
62
}
44
63
45
- export const DIRECTIVES = [ PickerFieldComponent , PickerValueAccessor ] ;
64
+ export const DIRECTIVES = [ PickerFieldComponent , PickerValueAccessor ] ;
0 commit comments