YPE-2195 - add onVersionPickerPress escape hatch + controlled BibleCard versionId#239
Open
cameronapak wants to merge 5 commits into
Conversation
…d versionId - BibleReader.Root: onVersionPickerPress threaded through context to Toolbar - BibleCard: controlled versionId via useControllableState, onVersionChange, onVersionPickerPress - BibleVersionPicker: guard isPopoverOpen when escape hatch active, move filteredRecentVersions to context - BibleChapterPicker: guard isPopoverOpen when onChapterPickerPress active - Remove BibleWidgetView (zero consumers) - Export BibleVersionPickerPressData type YPE-2195
🦋 Changeset detectedLatest commit: f6e7294 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
cameronapak
commented
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CleanShot.2026-05-15.at.15.45.36.mp4
Summary
Two changes for React Native consumers:
onVersionPickerPressescape hatch — Pass this callback toBibleReader.RootorBibleCardto intercept version picker taps and show your own native sheet instead of the built-in popover.Controlled
BibleCard.versionId—versionIdis now optional. PassdefaultVersionId+onVersionChangefor controlled behavior, or justversionIdfor uncontrolled (backwards compatible).Closes YPE-2195
Greptile Summary
This PR adds an
onVersionPickerPressescape-hatch prop toBibleReader.RootandBibleCard, allowing React Native consumers to intercept version-picker presses and render native sheets instead of the web popover. It also makesBibleCard.versionIdproperly controllable viauseControllableState, with a carefully guardedisControlledcheck that preserves uncontrolled backwards-compat when onlyversionId(noonVersionChange) is supplied.Rootskips the<Popover>wrapper,Triggerbecomes a plain<button>that callsonVersionPickerPress, andContentreturnsnullearly — cleanly suppressing the popover on all three sides.filteredRecentVersionsrefactor: computation moved fromContentandBibleVersionPickerLanguageTriggerinto the Root context, eliminating duplication.BibleCardcontrollable state:isControlledgate (versionId !== undefined && onVersionChange !== undefined) ensures existing consumers who pass onlyversionIdkeep their current uncontrolled behaviour.Confidence Score: 5/5
Safe to merge — the escape-hatch and controlled-state logic is correctly guarded on all three sides (Root wrapper, Trigger rendering, Content early-return), and the isControlled gate preserves existing consumer behaviour.
All three surfaces of the escape hatch (Root skips Popover, Trigger renders plain button, Content returns null) are consistent and mutually reinforcing. The BibleCard controllable-state gate correctly distinguishes fully-controlled from uncontrolled-seeded-by-prop scenarios. The filteredRecentVersions move to Root context is a clean dedup with no functional change. No regressions were found in the changed paths.
No files require special attention.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Consumer as Native Consumer participant Root as BibleVersionPicker.Root participant Trigger as BibleVersionPicker.Trigger participant Content as BibleVersionPicker.Content note over Root: onVersionPickerPress provided Root->>Root: Renders Context.Provider only (no Popover wrapper) Consumer->>Trigger: user taps version button Trigger->>Trigger: renders plain button (not PopoverTrigger) Trigger->>Consumer: calls onVersionPickerPress with versionId and languageId Content->>Content: returns null (escape hatch guard fires) note over Root: onVersionPickerPress NOT provided Root->>Root: Renders Context.Provider + Popover wrapper Consumer->>Trigger: user taps version button Trigger->>Root: PopoverTrigger toggles isPopoverOpen Root->>Content: isPopoverOpen true, renders PopoverContentComments Outside Diff (1)
packages/ui/src/components/bible-version-picker.tsx, line 546-598 (link)When
onVersionPickerPressis set, theContentcomponent falls through the!onVersionPickerPressguard and renders a plain, always-visible<div>containing the full version picker UI. BothBibleReader's Toolbar andBibleCard'sBibleCardVersionPickerunconditionally include<BibleVersionPicker.Content />as a child, so enabling the escape hatch immediately injects a permanently-expanded version list inline into the toolbar / card — the opposite of the "suppress popover" intent.The simplest fix is to return
nullearly when the escape hatch is active and the caller hasn't supplied explicitopen/onRequestCloseprops (i.e., the default usage inside Toolbar andBibleCardVersionPicker).Prompt To Fix With AI
Reviews (4): Last reviewed commit: "refactor(ui): use shared DEFAULT_LICENSE..." | Re-trigger Greptile