Skip to content

Commit 32b9ec2

Browse files
refactor: set selectedIndex = 3 of list-picker (NativeScript#5008)
* refactor: set selectedIndex = 3 of list-picker * refactor: list-picker.ts * refactor: list-picker.xml * fix: remove ios import
1 parent b192abf commit 32b9ec2

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
import { ListPicker } from "tns-core-modules/ui/list-picker";
2+
import { Page } from "tns-core-modules/ui/page";
3+
14
export function loaded(args) {
2-
var items = [];
5+
const items = [];
36
for (var i = 0; i < 100; i++) {
47
items.push("name" + i);
58
}
6-
args.object.bindingContext = { items: items };
7-
}
9+
10+
const target = (<Page>args.object.page).getViewById<ListPicker>("target");
11+
target.items = items;
12+
target.selectedIndex = 3;
13+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Page loaded="loaded">
22
<StackLayout>
3-
<ListPicker items="{{ items }}" style="color: deeppink; background-color:lightskyblue" />
3+
<ListPicker id="target" items="{{ items }}" style="color: deeppink; background-color:lightskyblue" />
44
</StackLayout>
55
</Page>

0 commit comments

Comments
 (0)