feat(ui): add BibleChapterPicker.Content onSelect + BibleReader onChapterPickerPress#234
Merged
cameronapak merged 3 commits intoMay 12, 2026
Conversation
…pterPickerPress context threading - Add BibleChapterPickerSelectData type and onSelect callback to Content - Content fires onSelect after state updates, before onRequestClose - Thread onChapterPickerPress through BibleReader.Root context to Toolbar - Export BibleChapterPickerSelectData from barrel - Tests: onSelect normal/intro chapters, default popover preserved, reader toolbar integration
🦋 Changeset detectedLatest commit: fa679e1 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 12, 2026
…ChapterPickerPress
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.
When working on YPE-2194, we found the React Web SDK needed some additional updates to handle what we need for React Native Expo SDK for the BibleChapterPicker in the BibleReader component, so here's the PR for this!
This MUST be merged before https://github.com/youversion/platform-sdk-reactnative-expo/pull/10
Summary
Adds
onSelectcallback toBibleChapterPicker.Contentand threadsonChapterPickerPressthroughBibleReader.Rootcontext toToolbar. This enables React Native consumers to intercept chapter selection without using the default popover.Changes
BibleChapterPickerBibleChapterPickerSelectDatatype:Pick<BibleChapterPickerPressData, 'book' | 'chapter' | 'versionId'>onSelectprop onBibleChapterPicker.Content— fires after internal state updates, beforeonRequestCloseonSelectis absent, default popover selection/close behavior is preservedBibleReaderonChapterPickerPressprop onRoot— threaded through context toToolbarToolbarpasses it toBibleChapterPicker.Root, which suppresses the default popover and delegates to the consumerExports
BibleChapterPickerSelectDataadded to barrel (components/index.ts)Tests
bible-chapter-picker.test.tsx: onSelect normal chapter, intro chapter, default popover preservedbible-reader.test.tsx: onChapterPickerPress fires when chapter nav button clickedTest plan
onChapterPickerPresssuppresses default popoverDownstream
This is a prerequisite for the React Native Expo chapter picker sheet integration.
Greptile Summary
This PR extends
BibleChapterPicker.Contentwith anonSelectcallback and threadsonChapterPickerPressfromBibleReader.Rootthrough context toToolbar, enabling React Native consumers to intercept chapter selection without triggering the default popover. A changeset file is included and theBibleChapterPickerSelectDatatype is exported from the barrel.BibleChapterPickerSelectDatais now a direct type alias ofBibleChapterPickerPressData, exported fromcomponents/index.tsfor consumer use.onSelectfires synchronously inContent.handleChapterButtonClickafter state setters are called (state commits on next render) and beforeonRequestClose; adata-testid=\"intro-chapter-button\"was added to the intro button to stabilise the new test.onChapterPickerPressis plumbed fromBibleReader.Rootprops → context →Toolbar→BibleChapterPicker.Root, suppressing the default popover when present; the newBibleReadertest verifies the callback fires and the popover stays hidden.Confidence Score: 5/5
Safe to merge — the new props are strictly additive and the default popover path is unchanged.
All three changed behaviours (onSelect on Content, onChapterPickerPress threading through BibleReader, and the new exports) are opt-in with no side-effects on existing consumers. The changeset is present, tests cover the new paths including the intro-chapter flow, and the type alias simplification from the prior review round was applied.
No files require special attention.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Consumer participant BibleReader.Root participant BibleReaderContext participant Toolbar participant BibleChapterPicker.Root participant BibleChapterPicker.Trigger participant BibleChapterPicker.Content Consumer->>BibleReader.Root: onChapterPickerPress prop BibleReader.Root->>BibleReaderContext: store onChapterPickerPress BibleReaderContext->>Toolbar: onChapterPickerPress (via context) Toolbar->>BibleChapterPicker.Root: onChapterPickerPress prop alt onChapterPickerPress provided BibleChapterPicker.Root->>BibleChapterPicker.Trigger: render as plain button (no Popover) Consumer->>BibleChapterPicker.Trigger: click BibleChapterPicker.Trigger->>Consumer: onChapterPickerPress Consumer->>BibleChapterPicker.Content: render explicitly with onSelect Consumer->>BibleChapterPicker.Content: user clicks chapter BibleChapterPicker.Content->>BibleChapterPicker.Content: setBook / setChapter / setSearchQuery BibleChapterPicker.Content->>Consumer: onSelect BibleChapterPicker.Content->>BibleChapterPicker.Content: onRequestClose?.() else no onChapterPickerPress (default) BibleChapterPicker.Root->>BibleChapterPicker.Root: wrap children in Popover Consumer->>BibleChapterPicker.Trigger: click (opens Popover) BibleChapterPicker.Root->>BibleChapterPicker.Content: auto-render inside PopoverContent Consumer->>BibleChapterPicker.Content: user clicks chapter BibleChapterPicker.Content->>BibleChapterPicker.Content: setBook / setChapter / setSearchQuery BibleChapterPicker.Content->>BibleChapterPicker.Root: onRequestClose → setIsPopoverOpen(false) endComments Outside Diff (1)
packages/ui/src/components/bible-chapter-picker.tsx, line 197-212 (link)onSelectunusable in default popover modeWhen
onChapterPickerPressis absent,Rootauto-rendersContentinsidePopoverContentand does not forward anyonSelectto it. A consumer who also explicitly renders<BibleChapterPicker.Content onSelect={...} />as a child will get twoContentinstances rendered simultaneously — the auto one (inside the popover, fires on click, closes the popover) and the explicit one (always visible, firesonSelect, but never receivesonRequestClose). This API contract should be documented or guarded so thatonSelecton an explicitContentis only valid whenonChapterPickerPressis also provided onRoot.Prompt To Fix With AI
Reviews (3): Last reviewed commit: "fix(ui): address greptile review — simpl..." | Re-trigger Greptile