1import { Button, List, Navigation, NavigationStack, Script, Section, Text } from "scripting"
2
3function Example() {
4
5 return <NavigationStack>
6 <List
7 navigationTitle={"ShareSheet"}
8 navigationBarTitleDisplayMode={"inline"}
9 >
10 <Section
11 footer={
12 <Text>Present a ShareSheet UI.</Text>
13 }
14 >
15 <Button
16 title={"ShareSheet.present"}
17 action={async () => {
18 // const image = await Photos.getLatestPhotos(1)
19 // await ShareSheet.present([image])
20 if (await ShareSheet.present(["Hello Scripting!"])) {
21 Dialog.alert({
22 message: "Share successfully."
23 })
24 } else {
25 Dialog.alert({
26 message: "Cancelled"
27 })
28 }
29 }}
30 />
31 </Section>
32 </List>
33 </NavigationStack>
34}
35
36async function run() {
37 await Navigation.present({
38 element: <Example />
39 })
40
41 Script.exit()
42}
43
44run()