Skip to content

Home screen widget

A widget on the iPhone's home screen that shows the start screen's avatar over a low-poly picture of the time of day, with the app's name, "Silver" ("Silver App" until October 22, 2026), in the top right corner. The name sits on a rounded veil at 50% opacity: light behind the day scenes' dark text, dark behind the night scenes' light text. Tapping anywhere on it opens the app. It is a target several times the size of the app icon, for a senior who finds the icon hard to hit or hard to pick out among the others.

With a reminder (The reminder) the avatar shrinks and the reminder takes up to three lines, starting at the left: under the avatar on the small and large widgets, beside it on the medium one. A reminder the Loved One typed on several lines (the web's three Line boxes, since October 22, 2026) shows those lines as they are. One typed on one line is broken by the app: a part in brackets and a time at the end get lines of their own, so "Urology Wed (In 7 days) 10:15" reads as:

Urology Wed
(In 7 days)
10:15

A reminder with neither wraps where it must. With more parts than three lines hold, the first ones share the first line (src/features/widget/reminder-lines.ts).

The widget shows nothing else. The only things that change are the background, six times a day (Time-of-day backgrounds), and the golf hole on its ground, once a day (The golf course). iOS only; the Android side of the library is not turned on.

Adding it to the phone

Do this once per phone, after the app has been opened at least once from the new build. iOS 17 and later:

  1. Touch and hold an empty spot on the home screen until the icons wobble.
  2. Tap Edit at the top left, then Add Widget.
  3. Search for Silver and tap it (Senior Health App on Build 49 and before, where the widget is called Memories).
  4. Swipe to the size you want. The large square is the easiest target; the wide one fits beside a row of icons.
  5. Tap Add Widget, drag it where it should go, and tap Done.

If the widget shows a red box that says "No layout found", the app has not run yet since it was installed. Open the app once and the widget fills in on its own within a few seconds.

How it works

The widget is built with expo-widgets, Expo's own library, so there is no Swift to maintain: the layout is a function in TypeScript that renders @expo/ui SwiftUI components.

  • src/features/widget/memories-widget.tsx is the layout. It starts with the 'widget' directive, which tells Babel to serialize the function and ship it to the widget extension, where a small JavaScript runtime evaluates it and SwiftUI draws the result. Because of that, the function may not use hooks, state, or anything declared outside itself (module-scope values are not there when it runs), which is why its fallback colors are literals copied from the splash background and src/theme/colors.ts rather than Daybreak tokens. The scene's background, text color, and base color arrive as props instead. It lays out a picture and a label, side by side in the wide size, stacked otherwise, over the background.
  • src/features/widget/sync-memories-widget.ts gives the widget its pictures. A widget cannot read the app's own files, only an App Group folder the two share (widgetsDirectory), so the app copies the bundled avatar, the six backgrounds, and the golf holes the coming week needs there. Then it hands the widget a timeline (updateTimeline): one entry per scene change for the next seven days, so iOS changes the background, and the hole with it, on time while the app is closed. The hook use-memories-widget.ts runs that from the root layout at launch and on every return from the background, and logs a failure instead of surfacing it; the app must open whether or not the widget has a picture. A silent push from the Worker, and a background refresh iOS runs now and then, also run it with a fresh reminder and schedule while the app is closed (Keeping the widget current).
  • The picture is assets/images/avatar/fencer-avatar-widget.png, a 768-pixel render of the avatar's SVG. scripts/render-avatar.sh makes it alongside the start screen's 1x, 2x and 3x renders; never edit the PNG by hand.
  • app.config.ts registers the widget with the expo-widgets config plugin: widget name MemoriesWidget (it must match MEMORIES_WIDGET_NAME), the sizes it offers, its content margins turned off so the background reaches the edges (the layout pads its own content), the extension's bundle id com.equalentry.seniorhealthapp.widgets, and the App Group group.com.equalentry.seniorhealthapp. On prebuild the plugin adds the extension target to the Xcode project, links the pods it needs, writes the entitlements for both targets, and adds the extension to extra.eas.build.experimental.ios.appExtensions so EAS Build signs it.

tests/memories-widget.test.ts covers the sync and the hook, and checks two things that would otherwise only fail on a phone: that Babel really turned the layout into a string (the directive is in place), and that app.config.ts names the same widget as the code. The SwiftUI rendering itself has no test; check it on a phone or the simulator after changing the layout.

Changing the picture

To show something else, for example a photo of Tom, add the file under assets/images/ and point the require in sync-memories-widget.ts at it. Keep it square or nearly so, at least 700 pixels on the long side, and as a PNG or JPEG. The widget scales it to fit, so no other change is needed. A new build is required; the picture travels inside the app bundle.

Building

The widget is a second native target, so it needs a new native build, not an over-the-air update: npx expo prebuild --clean locally, or a fresh EAS build.

The first EAS build after adding or changing an App Group has to be started from a terminal, not with --non-interactive. Registering an App Group and turning the capability on for a bundle id is something the App Store Connect API cannot do, so EAS needs a real Apple ID login for that one run (it asks for the Apple ID, password, and the two-factor code), after which the stored credentials cover every later build, non-interactive included. The sign of a non-interactive attempt is Failed to patch capabilities: [ { capabilityType: 'APP_GROUPS' ... } ] followed by an Apple API error about bundleIdCapabilities. The command:

cd ~/Documents/GitHub/SilverApp/apps/mobile && npx eas build --profile production --platform ios

Then submit that build by id, as Deploy to iPhone describes.

Related: Deploy to iPhone for the TestFlight steps, and App opens, which logs the opens the widget makes easier.