Example

1import { List, Navigation, NavigationStack, ProgressView, Script, Section, Text, useState, } from "scripting"
2
3function Example() {
4  const [timerFrom] = useState(() => Date.now())
5  const timerTo = timerFrom + 1000 * 60
6
7  return <NavigationStack>
8    <List
9      navigationTitle={"ProgressView"}
10      navigationBarTitleDisplayMode={"inline"}
11    >
12      <Section
13        header={
14          <Text>circular</Text>
15        }
16      >
17        <ProgressView
18          progressViewStyle={'circular'}
19        />
20      </Section>
21
22      <Section
23        header={
24          <Text>linear</Text>
25        }
26      >
27        <ProgressView
28          progressViewStyle={'linear'}
29          total={100}
30          value={50}
31          label={<Text>Progress 50%</Text>}
32          currentValueLabel={<Text>50</Text>}
33        />
34      </Section>
35
36      <Section
37        header={
38          <Text>TimerInterval</Text>
39        }
40      >
41        <ProgressView
42          progressViewStyle={'linear'}
43          timerFrom={timerFrom}
44          timerTo={timerTo}
45          countsDown={false}
46          label={<Text>Workout</Text>}
47        />
48      </Section>
49    </List>
50  </NavigationStack>
51}
52
53async function run() {
54  await Navigation.present({
55    element: <Example />
56  })
57
58  Script.exit()
59}
60
61run()