Skip to content

YPE-2479 - feat(ui): add onFootnotePress callback to BibleCard#238

Closed
Dustin-Kelley wants to merge 1 commit into
mainfrom
dk/YPE-2479-platform-sdk-react-add-optional-on-footnote-press-callback-to-bible-card-props
Closed

YPE-2479 - feat(ui): add onFootnotePress callback to BibleCard#238
Dustin-Kelley wants to merge 1 commit into
mainfrom
dk/YPE-2479-platform-sdk-react-add-optional-on-footnote-press-callback-to-bible-card-props

Conversation

@Dustin-Kelley
Copy link
Copy Markdown
Collaborator

@Dustin-Kelley Dustin-Kelley commented May 15, 2026

Summary

  • Add optional onFootnotePress to BibleCardProps and pass it through to BibleTextView (same pattern as BibleReader)
  • Add unit test verifying footnote tap invokes the callback with FootnoteData
  • Add patch changeset for @youversion/platform-react-ui

Test plan

  • pnpm --filter @youversion/platform-react-ui test -- bible-card.test.tsx
  • pnpm --filter @youversion/platform-react-ui typecheck
  • pnpm --filter @youversion/platform-react-ui lint

Made with Cursor

Greptile Summary

This PR adds an optional onFootnotePress callback to BibleCard, mirroring the identical pattern already established in BibleReader. When provided, it replaces the default footnote popover with a custom handler receiving FootnoteData; when omitted, behaviour is unchanged.

  • bible-card.tsx: Adds onFootnotePress?: (data: FootnoteData) => void to BibleCardProps and threads it through to BibleTextView, consistent with BibleReader's implementation.
  • bible-card.test.tsx: Adds a new describe block that renders BibleCard with footnote-containing HTML, clicks the footnote button, and asserts the callback receives the correct verseNum and reference.
  • .changeset/bible-card-footnote-press.md: Correct patch-level changeset entry for a non-breaking additive API change.

Confidence Score: 5/5

Safe to merge; the change is a purely additive, optional prop that does not alter existing behaviour when omitted.

The new prop is optional and defaults to undefined, so all existing BibleCard usages are unaffected. The implementation is a direct copy of the established BibleReader pattern with no novel logic. The unit test correctly uses waitFor to accommodate useLayoutEffect-driven DOM mutations and asserts both call count and payload fields.

No files require special attention.

Important Files Changed

Filename Overview
packages/ui/src/components/bible-card.tsx Adds onFootnotePress prop to BibleCardProps and passes it to BibleTextView; follows the exact same pattern as BibleReader.
packages/ui/src/components/bible-card.test.tsx New describe block covers the footnote press callback path; uses waitFor correctly for useLayoutEffect-driven DOM mutations.
.changeset/bible-card-footnote-press.md Patch changeset for @youversion/platform-react-ui; correctly scoped for a non-breaking additive change.

Sequence Diagram

sequenceDiagram
    participant Consumer
    participant BibleCard
    participant BibleTextView
    participant Verse.Html
    participant VerseFootnoteButton

    Consumer->>BibleCard: onFootnotePress (optional)
    BibleCard->>BibleTextView: onFootnotePress
    BibleTextView->>Verse.Html: onFootnotePress
    Verse.Html->>VerseFootnoteButton: onFootnotePress

    alt onFootnotePress provided
        VerseFootnoteButton-->>Consumer: onClick → onFootnotePress(FootnoteData)
    else onFootnotePress not provided
        VerseFootnoteButton-->>Consumer: shows default Popover
    end
Loading

Reviews (1): Last reviewed commit: "feat(ui): add onFootnotePress callback t..." | Re-trigger Greptile

Expose optional onFootnotePress on BibleCardProps and pass through to
BibleTextView so hosts can handle footnotes externally (e.g. RN sheet).

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 15, 2026

🦋 Changeset detected

Latest commit: 79a617b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@youversion/platform-react-ui Patch
vite-react Patch
@youversion/platform-core Patch
@youversion/platform-react-hooks Patch

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

@Dustin-Kelley Dustin-Kelley changed the title feat(ui): add onFootnotePress callback to BibleCard YPE-2479 - feat(ui): add onFootnotePress callback to BibleCard May 15, 2026
@Dustin-Kelley Dustin-Kelley requested a review from cameronapak May 15, 2026 16:44
@@ -0,0 +1,4 @@
---
"@youversion/platform-react-ui": patch
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cameronapak Should this be a patch?

@Dustin-Kelley Dustin-Kelley marked this pull request as ready for review May 15, 2026 16:45
@Dustin-Kelley Dustin-Kelley deleted the dk/YPE-2479-platform-sdk-react-add-optional-on-footnote-press-callback-to-bible-card-props branch May 15, 2026 16:58
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