MCPcopy Create free account
hub / github.com/expo/examples / CounterWidget

Function CounterWidget

with-widgets/widgets/CounterWidget.tsx:22–100  ·  view source on GitHub ↗
(props: CounterWidgetProps, environment: WidgetEnvironment)

Source from the content-addressed store, hash-verified

20};
21
22const CounterWidget = (props: CounterWidgetProps, environment: WidgetEnvironment) => {
23 'widget';
24 // Only show the full-color background in fullColor mode (or if undefined).
25 const isFullColor =
26 environment.widgetRenderingMode == null || environment.widgetRenderingMode === 'fullColor';
27 return (
28 <ZStack
29 alignment="leading"
30 modifiers={[containerBackground('#000000', 'widget'), clipShape('containerRelativeShape')]}>
31
32
33 <ZStack
34 alignment="bottomTrailing"
35 modifiers={[
36 frame({ maxWidth: Infinity, maxHeight: Infinity }),
37 clipShape('containerRelativeShape'),
38 zIndex(0),
39 ]}>
40 {isFullColor && (
41 <Rectangle
42 modifiers={[
43 foregroundStyle({
44 type: 'linearGradient',
45 colors: ['#58BEF6', '#366DF2'],
46 startPoint: { x: 0.5, y: 0 },
47 endPoint: { x: 0.5, y: 1 },
48 }),
49 frame({ maxWidth: Infinity, maxHeight: Infinity }),
50 ]}
51 />
52 )}
53
54 {props.gridUri && (
55 <Image
56 uiImage={props.gridUri}
57 modifiers={[
58 resizable(),
59 frame({ width: 150, height: 150 }),
60 scaleEffect(3),
61 offset({ x: 0, y: 100 }),
62 ]}
63 />
64 )}
65 </ZStack>
66
67 <VStack
68 alignment="leading"
69
70 spacing={4}
71 modifiers={[frame({ maxWidth: Infinity, alignment: 'leading' }), padding({ all: 16 }), zIndex(3)]}>
72 <HStack spacing={16}>
73 {props.logoUri && (
74 <Image
75 uiImage={props.logoUri}
76 modifiers={[resizable(), frame({ width: 16, height: 14 })]}
77
78 />
79 )}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected