Skip to content

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 ​

NameTypeDescription
children?ReactNodeReact children rendered inside the native hero container view.
duration?numberAnimation duration in milliseconds for time-based flights. Ignored when spring is provided.
easing?EasingNameEasing preset for duration-based flights. Ignored when spring is set.
enabled?booleanWhether this hero view participates in shared-element flights. Set to false to temporarily unregister the view without unmounting its React subtree.
fadeMode?FadeModeControls how the source and destination snapshots fade during the flight.
idstringStable 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?SharedHeroModeVisual 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?MotionPathTrajectory path followed by the flying element's center point. - "linear" (default): straight line from source to destination. - "arc": curved Material-style arc.
namespace?stringNamespace for isolating hero registries across independent tab trees or feature flows. The internal matching key is namespace::id.
onTransitionEnd()?(e) => voidCallback fired on the destination view when an inbound flight finishes, or on the source view when a return flight finishes.
onTransitionStart()?(e) => voidCallback fired on the source view when an outbound flight begins, or on the destination view when an interactive/automatic return flight begins.
returnFlightEnabled?booleanWhether 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?SpringConfigOptional spring physics configuration. When set, overrides duration and easing and drives the flight with native spring animations (CASpringAnimation on iOS, SpringAnimation on Android).

Released under the MIT License.