Developing Live Activities
Voltra provides APIs that make building and testing Live Activities easier during development.
Supported variants
Live Activities in iOS can appear in different contexts, and Voltra supports defining UI variants for each of these contexts. For detailed information about Live Activity design guidelines, see the Apple Human Interface Guidelines.
Lock Screen
The lockScreen variant defines how your Live Activity appears on the lock screen. It can be either a ReactNode directly, or an object with content and optional styling:
To customize the system Lock Screen chrome, pass an object with content and activityBackgroundTint:
activityBackgroundTint is applied via SwiftUI's activityBackgroundTint(...) modifier on iOS. Voltra currently accepts the same color formats handled by the native iOS parser:
- Hex colors such as
#RGB,#RGBA,#RRGGBB, and#RRGGBBAA rgb(...)andrgba(...)hsl(...)andhsla(...)- Named colors:
red,orange,yellow,green,mint,teal,cyan,blue,indigo,purple,pink,brown,white,gray,black,clear,transparent,primary,secondary
Use clear or transparent to make the Live Activity background transparent.
If the string cannot be parsed as one of those formats, iOS ignores the tint.
Dynamic Island
The island variant defines how your Live Activity appears in the Dynamic Island (available on iPhone 14 Pro and later). The Dynamic Island has three display states:
- Minimal: A compact pill-shaped view that appears when the activity is in the background
- Compact: A slightly larger view with leading and trailing regions
- Expanded: A full-width view with center, leading, trailing, and bottom regions
keylineTint uses the same iOS color parser and accepted formats as activityBackgroundTint.
Supplemental Activity Families (iOS 18+, watchOS 11+)
The supplementalActivityFamilies variant defines how your Live Activity appears on Apple Watch Smart Stack and CarPlay displays. This variant is optional and works seamlessly with your existing lock screen and Dynamic Island variants.
If supplementalActivityFamilies.small is not provided, Voltra will automatically construct it from your Dynamic Island compact variant by combining the leading and trailing content in an HStack.
Limitations
Animations and Live Updates
There are specific constraints on how content can animate or update:
- Continuous Animations: Custom continuous animations, such as rotating icons or elements moving along a path, are not supported.
- Smooth Updates: Per-second "live" updates are only supported by specific components designed for this purpose:
Timer: For countdowns and stopwatches.LinearProgressView: When used withtimerInterval.
- Styling Trade-offs: To enable smooth, system-driven animations (like a progress bar filling up in real-time), certain components may ignore custom styling properties (e.g., custom heights or thumb components) and fallback to standard system appearances.
All other components only update their visual state when a new activity state is pushed from your application.
useLiveActivity
For React development, Voltra provides the useLiveActivity hook for integration with the component lifecycle and automatic updates during development.
Unfortunately, iOS suspends background apps after approximately 30 seconds. This means that if you navigate away from your app (for example, to check the Dynamic Island or lock screen), live reload and auto-update functionality will be paused.
VoltraView Component
For testing and development, Voltra provides a VoltraView component that renders Voltra JSX components directly in your React Native app. This is useful for:
- Testing component layouts before deploying to Live Activities
- Handling user interactions in development
- Previewing how your Live Activity will look
Props:
id: Unique identifier for the view (used for event filtering)children: Voltra JSX components to renderstyle: React Native style for the containeronInteraction: Callback for user interactions with buttons/toggles
