MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / createPage

Function createPage

apps/automated/src/pages/page10.ts:8–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6import { Image } from '@nativescript/core/ui/image';
7
8export function createPage() {
9 var stack = new StackLayout();
10 var grid = new GridLayout();
11 stack.addChild(grid);
12
13 grid.addColumn(new ItemSpec(80, 'pixel'));
14 grid.addColumn(new ItemSpec(1, 'star'));
15 grid.addRow(new ItemSpec(1, 'auto'));
16 grid.addRow(new ItemSpec(1, 'auto'));
17
18 var defaultImageSource = ImageSource.fromFileSync(__dirname + '/test.png');
19
20 var img = new Image();
21 img.src = defaultImageSource;
22
23 img.width = 80;
24 img.height = 80;
25 img.verticalAlignment = 'bottom';
26 GridLayout.setRowSpan(img, 2);
27 grid.addChild(img);
28
29 var titleLabel = new Label();
30 titleLabel.textWrap = true;
31 titleLabel.text = 'some text goes here';
32 GridLayout.setColumn(titleLabel, 1);
33 grid.addChild(titleLabel);
34
35 var commentsLabel = new Label();
36 commentsLabel.text = 'comments';
37 commentsLabel.verticalAlignment = 'bottom';
38 GridLayout.setRow(commentsLabel, 1);
39 GridLayout.setColumn(commentsLabel, 1);
40 grid.addChild(commentsLabel);
41
42 var page = new Page();
43 page.content = stack;
44 page.css = 'GridLayout { background-color: yellow } image { background-color: green } label { background-color: red } stackpnael { background-color: pink }';
45
46 return page;
47}

Callers

nothing calls this directly

Calls 7

addColumnMethod · 0.95
addRowMethod · 0.95
addChildMethod · 0.45
fromFileSyncMethod · 0.45
setRowSpanMethod · 0.45
setColumnMethod · 0.45
setRowMethod · 0.45

Tested by

no test coverage detected