Skip to content

feat: implement Bible reader view for Android#39

Merged
sidorchukandrew merged 3 commits intomainfrom
as/kotlin-bible-reader
Feb 27, 2026
Merged

feat: implement Bible reader view for Android#39
sidorchukandrew merged 3 commits intomainfrom
as/kotlin-bible-reader

Conversation

@sidorchukandrew
Copy link
Collaborator

Description

This implements the Bible reader view for Android. The Kotlin SDK does not have all of the reader implemented natively yet, but this is enough for us to wrap it and expose it. Any changes made to the Kotlin side should not really affect the RN SDK.

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation update
  • refactor: Code refactoring (no functional changes)
  • perf: Performance improvement
  • test: Test additions or updates
  • build: Build system or dependency changes
  • ci: CI configuration changes
  • chore: Other changes (maintenance, etc.)

Checklist

  • My code follows the project's code style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • All commit messages follow conventional commits format
  • I have updated the appropriate section in documentation (if needed)

@sidorchukandrew sidorchukandrew self-assigned this Feb 18, 2026
@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 18, 2026

Greptile Summary

This PR replaces the Android Bible reader view placeholder with a real implementation that delegates to the Kotlin SDK's BibleReader composable. The bibleReference() method mirrors the iOS Swift counterpart's logic for constructing BibleReference objects from React Native props.

  • Crash risk from force-unwraps: Multiple !! operators on nullable MutableState props (initialized to null) in both Content() and bibleReference() will throw NullPointerException if the composable renders before React Native delivers prop values. The iOS version avoids this because Swift's @Field provides non-optional defaults.
  • Unused import in module: YVPBibleWidgetView is imported in RNBibleReaderViewModule.kt but not used — it's already registered in its own module.
  • Unused imports in view: AutoSizingComposable, Direction, and EnumSet are imported but not referenced, likely carried over from YVPSignInWithYouVersionButton.kt.

Confidence Score: 2/5

  • This PR has a high risk of runtime crashes due to force-unwrapping nullable props that start as null.
  • The core logic is sound and mirrors the iOS implementation, but the force-unwrap operators (!!) on MutableState<String?> and MutableState<Int?> props initialized to null will cause NullPointerException crashes. Compose may invoke Content() before React Native has delivered all prop values, making this a likely crash scenario rather than a theoretical one.
  • android/src/main/java/com/youversion/reactnativesdk/views/YVPBibleReaderView.kt — force-unwraps on lines 37, 38, 49, 50, 51, 59, 60, 61 need null-safety guards.

Important Files Changed

Filename Overview
android/src/main/java/com/youversion/reactnativesdk/RNBibleReaderViewModule.kt Adds unused import of YVPBibleWidgetView; the module definition itself is correct and follows existing patterns.
android/src/main/java/com/youversion/reactnativesdk/views/YVPBibleReaderView.kt Replaces placeholder with real BibleReader composable. Contains force-unwrap operators (!!) on nullable props that will cause NullPointerException crashes if props are not set before first composition. Also has 3 unused imports.

Sequence Diagram

sequenceDiagram
    participant RN as React Native
    participant Module as RNBibleReaderViewModule
    participant View as YVPBibleReaderView
    participant Compose as Jetpack Compose
    participant SDK as BibleReader (Kotlin SDK)

    RN->>Module: Register "BibleReaderView"
    RN->>View: Create view with props
    Note over View: Props initialized to null
    RN->>View: Set appName, signInMessage, versionId, bookUSFM, chapter, etc.
    Compose->>View: Content(modifier)
    View->>View: bibleReference()
    alt verseStart & verseEnd set
        View->>SDK: BibleReference(versionId, bookUSFM, chapter, verseStart, verseEnd)
    else hasReference == true
        View->>SDK: BibleReference(versionId, bookUSFM, chapter, verse?)
    else no reference
        View->>SDK: null
    end
    View->>SDK: BibleReader(appName, signInMessage, bibleReference)
Loading

Last reviewed commit: 22e36fd

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

@mic-mart mic-mart requested a review from bmanquen February 19, 2026 00:07
Copy link
Collaborator

@bmanquen bmanquen left a comment

Choose a reason for hiding this comment

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

The greptile comments make sense to me.

In addition I am not able to see this working locally. This is what I am getting:

Image

@sidorchukandrew
Copy link
Collaborator Author

The greptile comments make sense to me.

In addition I am not able to see this working locally. This is what I am getting:

Image

Are you still getting this?

@bmanquen
Copy link
Collaborator

The greptile comments make sense to me.
In addition I am not able to see this working locally. This is what I am getting:
Image

Are you still getting this?

No it is working now but the reader does look a bit different than the Kotlin BibleReader.
RN:
image
Android:
image

@sidorchukandrew
Copy link
Collaborator Author

The greptile comments make sense to me.
In addition I am not able to see this working locally. This is what I am getting:
Image

Are you still getting this?

No it is working now but the reader does look a bit different than the Kotlin BibleReader. RN: image Android: image

Hmm, maybe this is an older version of the Bible reader? When we bump to match the latest version of the Kotlin SDK, I'm sure this will update on its own with minor changes needed for the RN SDK.

Copy link
Collaborator

@bmanquen bmanquen left a comment

Choose a reason for hiding this comment

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

Approved, assuming the UI differences will be resolved when we update the Android SDK version.

@sidorchukandrew sidorchukandrew merged commit 681b51b into main Feb 27, 2026
2 of 3 checks passed
@sidorchukandrew sidorchukandrew deleted the as/kotlin-bible-reader branch February 27, 2026 17:40
jhampton pushed a commit that referenced this pull request Feb 27, 2026
## 0.10.0 (2026-02-27)

* feat: implement Bible reader view for Android (#39) ([681b51b](681b51b)), closes [#39](#39)
* YPE-1178 Add IOS CI build test (#34) ([3ae7dad](3ae7dad)), closes [#34](#34)
@github-actions
Copy link

🎉 This PR is included in version 0.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants