About this animation
A React Native glass pill turns a glanceable status into focused controls without navigating away from the current screen. This component moves between compact, expanded, and full-card states: tap opens the compact controls, long press reveals the full view, and an upward swipe collapses it. Use it for timers, recording status, delivery progress, media activity, or another live task that needs more detail on demand. One Reanimated spring progress value drives size changes and content crossfades, while Gesture Handler keeps touch transitions direct. Expo Blur and Expo Linear Gradient create a dark iOS 26-style glass material. The timer updates independently from animation, and the API supports controlled or uncontrolled state, glass settings, duration, and accent color.
When to use it
- Expand a live timer into focused controls.
- Show recording or delivery status over content.
- Reveal details without changing screens.
- Collapse a transient activity with a swipe.
A delivery status pill that expands into an action card, with configurable copy, glass treatment, accent color, and fonts.
How it works
- The component measures its own container and derives all three widths from the available space.
- One continuous shared value drives width, height, corner radius, content staging, and the drag interaction.
- Tap opens a clearly staged delivery card with the current step, arrival time, courier, and actions; hold opens the complete delivery note.
- A vertical drag can interrupt either spring at any point while the app content gently recedes behind the material.
- Expanded content waits until the surface is nearly settled, then appears through a short fade and blur veil.
- A restrained light sweep and accent pulse mark state changes without competing with the delivery information.
Why this one
Most expanding pills stop at a shape morph. This version presents one coherent product story in every state: the compact island answers “how long,” the summary separates the current step, arrival time, courier, and actions, and the full view adds the handoff note. The demo gives the island a complete delivery screen with a curated courier illustration, live location context, and a carefully spaced order summary. Deep black material, a single luminous accent, interruptible physics, and deliberately staged content make it feel native instead of decorative.
Install
npx expo install expo-blur expo-linear-gradient react-native-gesture-handler react-native-reanimated react-native-workletsUsage
import { DynamicGlassPill } from './DynamicGlassPill';
export function DeliveryHeader() {
return <DynamicGlassPill timerSeconds={479} />;
}Customize the copy, color, actions, and type:
<DynamicGlassPill
accentColor="#7CE8FF"
title="Courier is nearby"
etaLabel="Arrives by 7:10 PM"
destination="Side door · Ring once"
primaryActionLabel="Open map"
secondaryActionLabel="Message"
fontFamily="YourSansFont"
monoFontFamily="YourMonoFont"
onPrimaryAction={openTracking}
onSecondaryAction={contactCourier}
/>The forwarded ref exposes expand(), showDetails(), and collapse().
Props
| Prop | Type | Default | Description |
|---|---|---|---|
blurTarget | React.RefObject<View | null> | undefined | Ref to a host BlurTargetView behind the pill for Android blur. |
value | DynamicGlassPillValue | undefined | Controlled presentation state. |
defaultValue | DynamicGlassPillValue | 'compact' | Initial state when the component is uncontrolled. |
onChange | (value: DynamicGlassPillValue) => void | undefined | Called after an interaction requests a new presentation state. |
glass | { intensity?: number; tint?: BlurTint; highlight?: number } | undefined | Dark-material blur intensity, tint, and inner-highlight opacity. |
accentColor | string | '#B8FF5A' | Single accent used for progress, glow, and the status icon. |
timerSeconds | number | 479 | Live countdown in seconds; prop changes reset it. |
title | string | 'Order on the way' | Main delivery title. |
statusLabel | string | 'EN ROUTE' | Compact-state activity label. |
etaLabel | string | 'Arrives by 6:42 PM' | Estimated-arrival label. |
destination | string | 'Front door · Leave at the entrance' | Supporting destination text in the full state. |
primaryActionLabel | string | 'Track order' | First action label. |
secondaryActionLabel | string | 'Contact' | Second action label. |
onPrimaryAction | () => void | undefined | Called when the primary action is pressed. |
onSecondaryAction | () => void | undefined | Called when the secondary action is pressed. |
fontFamily | string | undefined | Font family for interface copy. |
monoFontFamily | string | undefined | Font family for changing numeric values. |
style | StyleProp<ViewStyle> | undefined | Optional style for the outer container. |
accessibilityLabel | string | 'Delivery live activity' | Screen-reader label for the live activity. |
testID | string | undefined | Test identifier applied to the outer container. |
duration | number | 560 | Activity highlight sweep duration in milliseconds. Spring physics and reduced-motion timing are unchanged. |
Compatibility
- Expo SDK 58
- React Native 0.88
- Reanimated 4.7 and Worklets 0.13
- iOS: supported
- Android: supported; native blur is used on Android 12 and newer
- Web: supported
- Works in Expo Go because every native dependency is included in Expo SDK 58
Accessibility
The activity exposes a labeled button with its expanded state, and both actions are independently labeled buttons. Tap provides an alternative to drag and hold. Reduced Motion switches directly between static sizes, removes content translations, and disables the light sweep and pulse.
For Android blur, wrap the backdrop in BlurTargetView from expo-blur, create its ref with useRef<View | null>(null), and pass that ref as blurTarget. The target must cover the blur bounds and exclude the blur itself. Without a target, the existing tint/background remains the fallback. dimezisBlurViewSdk31Plus enables blur on Android 12 and newer while keeping the fallback on older Android versions.
FAQ
- Does the expanding glass pill require a development build?
- Its dependencies are Expo Blur, Expo Linear Gradient, Gesture Handler, and Reanimated for Expo SDK 58 and Expo SDK 57. Each published piece is reviewed on physical iPhone and Android devices with Expo Go before release.
- Can I control the expanded state myself?
- Yes. Use value for controlled state or defaultValue for local state, then customize timerSeconds, the glass material, and accentColor.
- Is there an accessible alternative to every gesture?
- Yes. The pill is a labeled button, and tap and long press expose its states. Reduce Motion makes state transitions immediate instead of springing between sizes.




