Skip to content

feat(ui): native Reader Search (YPE-5748) - #184

Draft
Dustin-Kelley wants to merge 1 commit into
ype-5953-reader-toolbar-v2from
ype-5748-search-ui
Draft

Dustin-Kelley wants to merge 1 commit into
ype-5953-reader-toolbar-v2from
ype-5748-search-ui

Conversation

@Dustin-Kelley

@Dustin-Kelley Dustin-Kelley commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Native Search in the Reader: internal Input, Search sheet, and a Search icon in the native toolbar row (showToolbar).
  • Result tap dismisses the sheet and uses BibleReaderNavigation (chapter only). No Web SDK change. Scroll-to-verse is not in this PR.

Stack

  1. YPE-5746 Search client — merged into Search (feat(core): wrap platform-core SearchClient (YPE-5746) #180)
  2. YPE-5745 BibleReaderNavigation — feat(ui): BibleReaderNavigation chapter jumps (YPE-5745) #182
  3. YPE-5712 native toolbar — merged (feat(ui): native Reader toolbar (YPE-5712) #191)
  4. This PR — YPE-5748 → ype-5745-reader-navigation

YPE-5747 (scroll/focus) is out of this stack.

Test plan

  • Native toolbar Search icon present when showToolbar is true; absent when false; no spare bar
  • Open sheet: trending when empty; typing debounces; suggestion tap submits
  • Result tap closes sheet and loads that book/chapter/version
  • Malformed USFM stays in Search; page failure keeps results
  • Input and Search sheet are not public exports
  • pnpm typecheck / pnpm test / pnpm lint from worktree root

Made with Cursor

RetriggerConfidence Score: 2/5

The PR does not yet appear safe to merge because navigation can still be lost before commit, the public example repeatedly resets the reader, and generated localization catalogs remain hand-edited.

Fix All in Claude CodeFindings

  1. P1 Navigation is consumed before commit
  2. P1 Generated locale catalogs edited directly
  3. P2 Example requests navigation every render
Fix with agent prompt
### Issue 1
packages/ui/src/native/bible-reader-navigation.ts:undefined-122
When React abandons or suspends a render, `consumePending()` has already cleared the request, causing the committed reader to miss the requested book, chapter, and version. Please retain the request through rendering and clear it only after the render applying it commits.

### Issue 2
packages/ui/src/i18n/locales/en.json:8-10
These values are being added directly to generated locale files, so the catalogs diverge from their canonical source and can be overwritten or rejected by localization synchronization. Please add the keys under `reactnative.*` in platform-localization and let the distribution workflow update both catalogs.

### Issue 3
README.md:167-173
The memoized object is stable, but this unconditional `navigation.request()` runs after every `ReaderScreen` render. Consumers copying the example will repeatedly reset the reader to John 3 and notify subscribers on unrelated rerenders.

```suggestion
function ReaderScreen() {
  const navigation = useMemo(() => {
    const readerNavigation = createBibleReaderNavigation()
    readerNavigation.request({ versionId: 111, bookId: 'JHN', chapter: 3, verse: 16 })
    return readerNavigation
  }, [])

  return <BibleReader navigation={navigation} defaultVersionId={3034} />
}
```

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR adds native Reader Search with a toolbar entry point, debounced suggestions, trending and recent searches, paginated verse results, and chapter-only navigation from selected results.

  • Adds an internal native Input primitive and Search sheet.
  • Adds search state, result enrichment, pagination, stale-request handling, and persisted recent searches.
  • Extends USFM parsing to chapter-only references and verse ranges.
  • Integrates Search into the native Reader toolbar and navigation flow.

Diagram

sequenceDiagram
  participant U as User
  participant T as Reader Toolbar
  participant S as Search Sheet
  participant A as Search API
  participant C as Bible Content
  participant N as Reader Navigation
  U->>T: Tap Search
  T->>S: Open sheet
  S->>A: Load trending or debounced suggestions
  U->>S: Submit query
  S->>A: Request verse hits
  A-->>S: USFM results
  S->>C: Enrich result titles and snippets
  C-->>S: Passage metadata
  U->>S: Select result
  S->>N: Request version, book, and chapter
  S->>S: Dismiss sheet
Loading

Reviews (2) · Last reviewed commit: "feat(ui): restack Reader Search onto Swi..."

@Dustin-Kelley
Dustin-Kelley added this pull request to stack #185 September 10, 2026 19:05
@cursor
cursor Bot force-pushed the ype-5748-search-ui branch from cb44449 to a07af81 Compare September 15, 2026 22:29
@Dustin-Kelley
Dustin-Kelley removed this pull request from stack #185 September 18, 2026 13:14
@Dustin-Kelley
Dustin-Kelley added this pull request to stack #199 September 18, 2026 13:14
Search belongs in the 5953 spacer. The old row put it between version and gear, and that chrome is gone.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Dustin-Kelley

Copy link
Copy Markdown
Collaborator Author

Restacked onto ype-5953-reader-toolbar-v2 (57efcf4). Search now sits in the Swift spacer, not on the old avatar row. Duplicate showToolbar reset is gone.

posted by Cursor on behalf of Dustin

@Dustin-Kelley
Dustin-Kelley marked this pull request as ready for review September 21, 2026 17:55
@Dustin-Kelley
Dustin-Kelley removed this pull request from stack #199 September 21, 2026 17:57
@Dustin-Kelley
Dustin-Kelley changed the base branch from ype-5745-reader-navigation to ype-5953-reader-toolbar-v2 September 21, 2026 17:57
@Dustin-Kelley
Dustin-Kelley added this pull request to stack #203 September 21, 2026 17:57
return null
}
return navigation.pendingRequest
return navigation.consumePending()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Navigation is consumed before commit

When React abandons or suspends a render, consumePending() has already cleared the request, causing the committed reader to miss the requested book, chapter, and version. Please retain the request through rendering and clear it only after the render applying it commits.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/ui/src/native/bible-reader-navigation.ts
Line: 122

Comment:
**Navigation is consumed before commit**

When React abandons or suspends a render, `consumePending()` has already cleared the request, causing the committed reader to miss the requested book, chapter, and version. Please retain the request through rendering and clear it only after the render applying it commits.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Cursor Fix in Codex

Comment thread README.md
Comment on lines 167 to 173
function ReaderScreen() {
const navigation = useMemo(() => {
const readerNavigation = createBibleReaderNavigation()
readerNavigation.request({ versionId: 111, bookId: 'JHN', chapter: 3, verse: 16 })
return readerNavigation
}, [])
const navigation = useMemo(() => createBibleReaderNavigation(), [])

navigation.request({ versionId: 111, bookId: 'JHN', chapter: 3, verse: 16 })

return <BibleReader navigation={navigation} defaultVersionId={3034} />
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Example requests navigation every render

The memoized object is stable, but this unconditional navigation.request() runs after every ReaderScreen render. Consumers copying the example will repeatedly reset the reader to John 3 and notify subscribers on unrelated rerenders.

Suggested change
function ReaderScreen() {
const navigation = useMemo(() => {
const readerNavigation = createBibleReaderNavigation()
readerNavigation.request({ versionId: 111, bookId: 'JHN', chapter: 3, verse: 16 })
return readerNavigation
}, [])
const navigation = useMemo(() => createBibleReaderNavigation(), [])
navigation.request({ versionId: 111, bookId: 'JHN', chapter: 3, verse: 16 })
return <BibleReader navigation={navigation} defaultVersionId={3034} />
}
function ReaderScreen() {
const navigation = useMemo(() => {
const readerNavigation = createBibleReaderNavigation()
readerNavigation.request({ versionId: 111, bookId: 'JHN', chapter: 3, verse: 16 })
return readerNavigation
}, [])
return <BibleReader navigation={navigation} defaultVersionId={3034} />
}
Prompt To Fix With AI
This is a comment left during a code review.
Path: README.md
Line: 167-173

Comment:
**Example requests navigation every render**

The memoized object is stable, but this unconditional `navigation.request()` runs after every `ReaderScreen` render. Consumers copying the example will repeatedly reset the reader to John 3 and notify subscribers on unrelated rerenders.

```suggestion
function ReaderScreen() {
  const navigation = useMemo(() => {
    const readerNavigation = createBibleReaderNavigation()
    readerNavigation.request({ versionId: 111, bookId: 'JHN', chapter: 3, verse: 16 })
    return readerNavigation
  }, [])

  return <BibleReader navigation={navigation} defaultVersionId={3034} />
}
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Cursor Fix in Codex

Comment on lines +8 to +10
"clearSearch": "Clear search",
"trendingSearches": "Trending Searches",
"recentSearches": "Recent Searches",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Generated locale catalogs edited directly

These values are being added directly to generated locale files, so the catalogs diverge from their canonical source and can be overwritten or rejected by localization synchronization. Please add the keys under reactnative.* in platform-localization and let the distribution workflow update both catalogs.

Rule Used: Translation JSON under packages/ui/src/i18n/locales/ (en.json, es.json, fr.json, and any future locale) is generated and synced from the platform-localization repo. Do not hand-edit these files or add/change/remove string values directly in a PR. New... (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/ui/src/i18n/locales/en.json
Line: 8-10

Comment:
**Generated locale catalogs edited directly**

These values are being added directly to generated locale files, so the catalogs diverge from their canonical source and can be overwritten or rejected by localization synchronization. Please add the keys under `reactnative.*` in platform-localization and let the distribution workflow update both catalogs.

**Rule Used:** Translation JSON under packages/ui/src/i18n/locales/ (en.json, es.json, fr.json, and any future locale) is generated and synced from the platform-localization repo. Do not hand-edit these files or add/change/remove string values directly in a PR. New... ([source](https://github.com/youversion/platform-sdk-reactnative-expo/blob/c082b4527b6a8a3cb8c56a4faad4ad6ef9edf13a/.greptile/config.json))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Cursor Fix in Codex

@Dustin-Kelley
Dustin-Kelley marked this pull request as draft September 21, 2026 18:07
@Dustin-Kelley
Dustin-Kelley marked this pull request as ready for review September 21, 2026 18:09
@Dustin-Kelley

Copy link
Copy Markdown
Collaborator Author

Locale JSON guard is red because this PR adds clearSearch, trendingSearches, and recentSearches in en.json and es.json by hand. The same clearSearch strings already sit in localization sync PR 200. This PR cannot ship those JSON files. Add the keys in platform-localization, let that sync land on this stack's base, then drop the JSON from 184.

Unit, lint, typecheck, build, and locale parity are green. Do not merge from this comment.

posted by Cursor on behalf of Dustin

@Dustin-Kelley
Dustin-Kelley marked this pull request as draft September 21, 2026 18:13
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