mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: update tslint rules (#7391)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ListPickerBase, Color, selectedIndexProperty, itemsProperty, backgroundColorProperty, colorProperty } from "./list-picker-common";
|
||||
import { ListPickerBase, Color, selectedIndexProperty, itemsProperty, backgroundColorProperty, colorProperty } from "./list-picker-common";
|
||||
import { ItemsSource } from ".";
|
||||
import { profile } from "../../profiling";
|
||||
|
||||
@@ -6,7 +6,7 @@ export * from "./list-picker-common";
|
||||
|
||||
export class ListPicker extends ListPickerBase {
|
||||
nativeViewProtected: UIPickerView;
|
||||
// tslint:disable-next-line
|
||||
// tslint:disable-next-line
|
||||
private _dataSource: ListPickerDataSource;
|
||||
private _delegate: ListPickerDelegateImpl;
|
||||
|
||||
@@ -84,6 +84,7 @@ class ListPickerDataSource extends NSObject implements UIPickerViewDataSource {
|
||||
public static initWithOwner(owner: WeakRef<ListPicker>): ListPickerDataSource {
|
||||
let dataSource = <ListPickerDataSource>ListPickerDataSource.new();
|
||||
dataSource._owner = owner;
|
||||
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
@@ -93,6 +94,7 @@ class ListPickerDataSource extends NSObject implements UIPickerViewDataSource {
|
||||
|
||||
public pickerViewNumberOfRowsInComponent(pickerView: UIPickerView, component: number) {
|
||||
let owner = this._owner.get();
|
||||
|
||||
return (owner && owner.items) ? owner.items.length : 0;
|
||||
}
|
||||
}
|
||||
@@ -105,6 +107,7 @@ class ListPickerDelegateImpl extends NSObject implements UIPickerViewDelegate {
|
||||
public static initWithOwner(owner: WeakRef<ListPicker>): ListPickerDelegateImpl {
|
||||
let delegate = <ListPickerDelegateImpl>ListPickerDelegateImpl.new();
|
||||
delegate._owner = owner;
|
||||
|
||||
return delegate;
|
||||
}
|
||||
|
||||
@@ -112,8 +115,10 @@ class ListPickerDelegateImpl extends NSObject implements UIPickerViewDelegate {
|
||||
let owner = this._owner.get();
|
||||
if (owner) {
|
||||
let title = NSAttributedString.alloc().initWithStringAttributes(owner._getItemAsString(row), <any>{ [NSForegroundColorAttributeName]: pickerView.tintColor });
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
return NSAttributedString.alloc().initWithStringAttributes(row.toString(), <any>{ [NSForegroundColorAttributeName]: pickerView.tintColor });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user