This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 54).
ProgressView
A SwiftUI ProgressView component for displaying progress indicators.
Expo UI ProgressView matches the official SwiftUI ProgressView API and supports styling via the progressViewStyle modifier.
Installation
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
Indeterminate progress
When no value is provided, the progress view displays an indeterminate indicator (spinner).
import { Host, ProgressView } from '@expo/ui/swift-ui'; export default function IndeterminateExample() { return ( <Host matchContents> <ProgressView /> </Host> ); }
Determinate progress
Provide a value between 0 and 1 to show determinate progress.
import { Host, ProgressView } from '@expo/ui/swift-ui'; export default function DeterminateExample() { return ( <Host matchContents> <ProgressView value={0.5} /> </Host> ); }
Progress view styles
Use the progressViewStyle modifier to change the progress view's appearance. Available styles are: automatic, linear, and circular.
import { Host, ProgressView, VStack } from '@expo/ui/swift-ui'; import { progressViewStyle } from '@expo/ui/swift-ui/modifiers'; export default function ProgressViewStylesExample() { return ( <Host matchContents> <ProgressView value={0.5} modifiers={[progressViewStyle('linear')]} /> </Host> ); }
With label
You can pass custom components as children to provide a label for the progress view.
import { Host, ProgressView, Text } from '@expo/ui/swift-ui'; export default function LabelExample() { return ( <Host matchContents> <ProgressView value={0.25}> <Text>Loading...</Text> </ProgressView> </Host> ); }
Tinted progress view
Use the tint modifier to change the progress view's color.
import { Host, ProgressView } from '@expo/ui/swift-ui'; import { tint } from '@expo/ui/swift-ui/modifiers'; export default function TintedExample() { return ( <Host matchContents> <ProgressView value={0.7} modifiers={[tint('red')]} /> </Host> ); }
Timer-based progress
Use the timerInterval prop to create a progress view that automatically animates over a time range. This is useful for showing countdown timers or timed operations.
Note: Timer-based progress is only available on iOS 16+ and tvOS 16+.
import { Host, ProgressView, Text, VStack } from '@expo/ui/swift-ui'; export default function TimerExample() { const startDate = new Date(); const endDate = new Date(Date.now() + 10000); // 10 seconds from now return ( <Host matchContents> <VStack spacing={16}> <ProgressView timerInterval={{ lower: startDate, upper: endDate }} /> <ProgressView timerInterval={{ lower: startDate, upper: endDate }} countsDown={false}> <Text>Counting up</Text> </ProgressView> </VStack> </Host> ); }
API
Component
Type: React.Element<ProgressViewProps>
Renders a SwiftUI ProgressView component.
boolean • Default: trueA Boolean value that determines whether the view empties or fills as time passes. If true, which is the default, the view empties.
ClosedRangeDateThe lower and upper bounds for automatic timer progress.
unionThe current progress value. A value between 0 and 1.
When undefined, the progress view displays an indeterminate indicator.
Acceptable values are: number | null