Skip to content

Feature: Sync backdrop animation with sheet #234

@varseb

Description

@varseb

Hi! First of all, great library! I'm using it in different projects.

Currently, when a sheet opens or closes, the backdrop uses its own independent animation that is out of sync with the sheet animation.

The backdrop has a fixed transition of duration: 1 while the sheet uses tweenConfig with a default duration: 0.2, this creates a noticeable desync.

Desired behavior

The sheet animation should control the backdrop animation.

  • The backdrop opacity should be derived directly from the sheet's position (y)
  • On open: the backdrop should appear in sync with the sheet movement
  • On close: the backdrop should fade out in sync with the sheet closing
  • During drag: the backdrop opacity should follow the finger position in real time

Technical context

  • Current backdrop: uses initial/animate/exit with transition: { duration: 1 } independent animation
  • Sheet: uses y (MotionValue) to control position, the context already exposes y to children
  • Proposed solution: use useTransform to derive backdrop opacity from y, with the formula opacity = 1 - (y / closedY). This would require exposing closedY in the context.

Benefits

  • Coherent and smooth animation
  • Better user experience
  • Backdrop automatically respects the sheet's tweenConfig and prefersReducedMotion
  • During drag, immediate and synced visual feedback

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions