Home screen widgets and Live Activities in Expo
Key Points
- React components for widgets
- Zero native prebuild setup
- Live Activities with push updates
Summary
Expo announced expo-widgets (alpha): a library that lets you build iOS home screen widgets and Live Activities using React components and Expo UI with no manual native setup. A config plugin and Continuous Native Generation create the Widget Extension, App Group, and necessary files during prebuild. Widgets are authored as self-contained React components using @expo/ui primitives (e.g. Text, VStack, HStack, Image) which are translated to SwiftUI views at render time.
Key Points
- Alpha release: expo-widgets removes most native setup required to ship widgets from a React Native app.
- Render model: widget components run in a separate JS runtime to produce an
@expo/uilayout tree; the native side reconstructs the UI with SwiftUI (no React Native rendering at widget render time). - Authoring constraints: components must be self-contained, marked with the
'widget'directive, and accept display data via props (including afamilysize field). - Interactivity: widgets can include interactive controls;
onPresshandlers return partial state updates that are merged and applied without launching the full app. - Live Activities: share the same authoring model but target multiple slots (Lock Screen banner, Dynamic Island compact/minimal/expanded); support push updates and push-to-start tokens via APNs.
- Limitations & next steps: images aren’t supported yet in Expo UI, APIs may change while alpha stabilizes; planned additions include timeline readback and refresh policy options.
Quick usage notes for engineers
- Minimal widget pattern: mark the component with the
'widget'directive and export withcreateWidget('Name', Component). - Schedule timelines from your app so the system shows the correct entries on schedule; use APNs to update Live Activities remotely.
- Expect breaking changes during alpha and test thoroughly on device profiles that exercise timelines and Live Activity updates.