Type Alias: SharedHeroProps
ts
type SharedHeroProps = ViewProps & object;Props accepted by SharedHero / SharedHeroView.
Extends React Native's standard ViewProps (style, onLayout, accessibility props, etc.). Style properties such as borderRadius and backgroundColor are read directly by the native transition coordinator in "morph" mode.
Type Declaration
| Name | Type | Description |
|---|---|---|
children? | ReactNode | React children rendered inside the native hero container view. |
duration? | number | Animation duration in milliseconds for time-based flights. Ignored when spring is provided. |
easing? | EasingName | Easing preset for duration-based flights. Ignored when spring is set. |
enabled? | boolean | Whether this hero view participates in shared-element flights. Set to false to temporarily unregister the view without unmounting its React subtree. |
fadeMode? | FadeMode | Controls how the source and destination snapshots fade during the flight. |
id | string | Stable identifier matched across screens or in-place state swaps. When a SharedHero with the same namespace and id unmounts (or becomes covered by a pushed screen) and another mounts within the native matching window, a flight runs between their window-space rects. |
mode? | SharedHeroMode | Visual transition style. - "snapshot" (default): bitmap clone, translate + scale + crossfade. - "morph": Material container transform that interpolates bounds, corner radius, background color, and clip shape. - "shuttle": alias of "snapshot" in v1. - "zoom" / "auto": system zoom where supported, otherwise "morph". |
motionPath? | MotionPath | Trajectory path followed by the flying element's center point. - "linear" (default): straight line from source to destination. - "arc": curved Material-style arc. |
namespace? | string | Namespace for isolating hero registries across independent tab trees or feature flows. The internal matching key is namespace::id. |
onTransitionEnd()? | (e) => void | Callback fired on the destination view when an inbound flight finishes, or on the source view when a return flight finishes. |
onTransitionStart()? | (e) => void | Callback fired on the source view when an outbound flight begins, or on the destination view when an interactive/automatic return flight begins. |
returnFlightEnabled? | boolean | Whether unmounting this hero triggers a return (back) flight to a still-mounted source hero with the same namespace::id. Set to false when the dismissal animation already moves the element away (for example, a React Native <Modal animationType="slide"> sliding down), preventing a redundant return flight after the modal closes. Affects only the unregister / back-flight path; inbound flights are unaffected. |
spring? | SpringConfig | Optional spring physics configuration. When set, overrides duration and easing and drives the flight with native spring animations (CASpringAnimation on iOS, SpringAnimation on Android). |