-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
BasicPager.tsx
39 lines (35 loc) · 994 Bytes
/
BasicPager.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import * as React from 'react';
import { Pager } from '@nativescript-community/ui-pager/react';
const items = [
{title: "First", color: "#e67e22"},
{title: "Second", color: "#3498db"},
{title: "Third", color: "#e74c3c"},
{title: "Fourth", color: "#9b59b6"},
];
interface Item {
title: string;
color: string;
}
const cellFactory = (item: Item) => (
<gridLayout backgroundColor={item.color} height={{ unit: "%", value: 100 }}>
<label
//@ts-ignore
width="100%"
text={item.title}
textAlignment={"center"}
verticalAlignment={"middle"}
fontSize={35}
textTransform={"uppercase"}
color={"white"} />
</gridLayout>
);
export function BasicPager() {
return (
<stackLayout>
<Pager
height={{ unit: "%", value: 100 }}
items={items}
cellFactory={cellFactory} />
</stackLayout>
);
}