YPE-2256: abstract BibleChapterPicker content + override#225
Merged
cameronapak merged 6 commits intomainfrom May 5, 2026
Merged
Conversation
…ess for custom handling
🦋 Changeset detectedLatest commit: de4d87f 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 |
…to improve state management
…ss is not provided
Excludes dist and node_modules from Vitest tests to prevent unexpected behavior.
Add checks for `scrollIntoView` availability and set a default book for the picker to improve user experience and robustness.
cameronapak
approved these changes
May 5, 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.
Summary
BibleChapterPicker.Contentfor standalone rendering (Expo DOM / native sheet).onChapterPickerPressto intercept trigger presses and suppress popover.@youversion/platform-react-ui.Test plan
pnpm --filter @youversion/platform-react-ui testMade with Cursor
Greptile Summary
This PR extracts the book-list and search UI into a standalone
BibleChapterPicker.Contentcomponent and adds anonChapterPickerPressprop toRootthat intercepts trigger presses and suppresses the built-in Popover, enabling consumers to render the picker inside a native bottom sheet or Expo DOM component.Contentextraction: book accordion, chapter buttons, and search input are moved from an inlinePopoverContentrender into a reusableContentcomponent that accepts an optionalonRequestClosecallback; popover mode passes() => setIsPopoverOpen(false), standalone mode omits it.onChapterPickerPressoverride: when set onRoot, theTriggerrenders a plainbutton(orcloneElementforasChild) and calls the callback with{ book, chapter, versionId }instead of opening the Popover.BibleChapterPicker.Content,BibleChapterPickerContentProps, andBibleChapterPickerPressDataare exported from the package index; a minor changeset is included.Confidence Score: 5/5
Safe to merge — the refactor is well-scoped, the existing popover path is preserved faithfully, and the new standalone path is exercised by the added tests.
The core popover flow is unchanged in behavior;
Contentis a mechanical extraction of the same JSX that was previously inlined. The override path is additive and guarded by a simple conditional. No data-loss or broken-contract scenarios were found in the changed code paths.packages/ui/src/components/bible-chapter-picker.tsx — the untracked
setTimeoutinscrollToCurrentBookis worth addressing before this becomes a source of multiple simultaneous scroll attempts.Important Files Changed
Contentcomponent, addsonChapterPickerPressoverride path that bypasses the Popover, and exposesContenton theBibleChapterPickernamespace. One new finding: untracked timer inscrollToCurrentBook.onChapterPickerPresscallback args, popover suppression when override is set, and default popover-open behaviour; ResizeObserver is correctly stubbed for jsdom.BibleChapterPickerContentProps,BibleChapterPickerPressData) alongside existing exports.@youversion/platform-react-uidescribing the newContentexport andonChapterPickerPressaddition.excludefordistandnode_modulesto the hooks package vitest config to prevent built artifacts from being picked up by the test runner.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[User clicks Trigger] --> B{onChapterPickerPress set on Root?} B -- Yes --> C[handlePress called] C --> D[props.onClick fired] D --> E[scrollToCurrentBook called] E --> F[onChapterPickerPress callback called with book/chapter/versionId] F --> G[Consumer renders native sheet / Expo DOM] G --> H[BibleChapterPicker.Content rendered standalone] H --> I{User selects chapter} I --> J[setBook + setChapter, setSearchQuery cleared, onRequestClose called] B -- No --> K[handleOpenPopover called] K --> L[props.onClick fired] L --> M[scrollToCurrentBook called] M --> N[Popover opens, Content rendered inside PopoverContent] N --> O{User selects chapter} O --> P[setBook + setChapter, setSearchQuery cleared, setIsPopoverOpen false]Prompt To Fix All With AI
Reviews (4): Last reviewed commit: "Fix scrolling and default book in Bible ..." | Re-trigger Greptile
Context used:
Learned From
lifechurch/youversion/user-applications/mobile/bible-ios#4801