Skip to content

feat(web): pluggable web renderer with vaul support#639

Draft
lodev09 wants to merge 21 commits intomainfrom
feat/web-renderer
Draft

feat(web): pluggable web renderer with vaul support#639
lodev09 wants to merge 21 commits intomainfrom
feat/web-renderer

Conversation

@lodev09
Copy link
Copy Markdown
Owner

@lodev09 lodev09 commented Apr 4, 2026

Summary

Make the web sheet renderer explicit and pluggable via TrueSheet.setWebRenderer(). Both gorhom and vaul are now opt-in through sub-path imports — no default renderer, error with instructions if unset on web.

Consumer usage:

import { TrueSheet } from '@lodev09/react-native-true-sheet'
import { GorhomRenderer } from '@lodev09/react-native-true-sheet/gorhom'
// or: import { VaulRenderer } from '@lodev09/react-native-true-sheet/vaul'

TrueSheet.setWebRenderer(GorhomRenderer) // or VaulRenderer

Key changes:

  • Core web files (TrueSheet.web.tsx, TrueSheetProvider.web.tsx) are now thin delegators with zero renderer-specific imports
  • Shared web utilities extracted to src/web/ (constants, utils, types, registry, SheetContext)
  • Gorhom implementation moved to src/gorhom/ sub-path export
  • New vaul implementation in src/vaul/ sub-path export
  • setWebRenderer is a no-op on native

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Test Plan

  • Verified gorhom renderer works (bundles and renders correctly on web)
  • Verified vaul renderer renders sheets on web
  • Verified error message when no renderer is set
  • Verify native (iOS/Android) is unaffected by setWebRenderer no-op
  • Full event lifecycle testing (present/dismiss/detent changes)
  • Stack behavior testing with multiple sheets

Checklist

  • I tested on iOS
  • I tested on Android
  • I tested on Web
  • I updated the documentation (if needed)
  • I added a changelog entry (if needed)

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-native-true-sheet Ready Ready Preview, Comment Apr 18, 2026 5:59am

Request Review

lodev09 added 5 commits April 14, 2026 01:42
Strip to bare present/dismiss with overlay, content, and handle.
Move vaul source into src/web/vaul as the sole web drawer. Remove
renderer registry, setWebRenderer, and /gorhom and /vaul subpath
exports. Scaffold provider context in TrueSheetProvider.web.tsx
for direct implementation.
Drop the src/web/vaul ignore rules from prettier and eslint, run
prettier across the directory, and trim the README to basic fork
attribution.
@github-actions
Copy link
Copy Markdown

Hey @lodev09, this PR is missing a changelog entry.

Add the following under the Unreleased section in CHANGELOG.md:

- **platform**: Description. ([#639](https://github.com/lodev09/react-native-true-sheet/pull/639) by [@lodev09](https://github.com/lodev09))

See CONTRIBUTING.md for more details.

lodev09 added 6 commits April 18, 2026 09:02
Default to 0 for native parity (always dimmed). Fix vaul's
getPercentageDragged to handle fadeFromIndex === 0: at the lowest
detent dismiss drag returns null so the default distance-based
fade-out applies; all other positions return 0 to stay opaque.
Drive the RAF only while the drawer is actually moving (drag, CSS
transition, CSS animation) so idle sheets cost zero frames. Move
tracking into Content so listeners live for the drawer element's
lifetime, including the close animation before Radix unmounts the
portal.
Define TrueSheetMethods and TrueSheetStaticMethods in TrueSheet.types,
have the native class and web component implement them. Support the
index/animated params on web by controlling vaul's activeSnapPoint.
Wire the dimmed prop to vaul's modal, and fix the dim overlay not
appearing on non-fade snap presents by firing snapToPoint on every
open transition.
When the active snap is below fadeFromIndex the overlay is transparent
and we want the sheet to behave as non-modal: clicks reach the content
behind the drawer and outside-clicks don't dismiss. Drive this off the
current snap index so crossing the fade threshold flips modal behavior
without unmounting the overlay.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant