feat: Implement all Compose views#42
feat: Implement all Compose views#42sidorchukandrew wants to merge 13 commits intoas/new-kotlin-versionfrom
Conversation
This isn't a change in functionality, but it matches what Expo is doing with their Compose components.
Greptile SummaryThis PR brings the Android (Kotlin/Compose) side of the React Native SDK up to parity with the existing Swift SDK. It replaces the old Key changes:
Confidence Score: 4/5Safe to merge with awareness that several props ( The PR makes solid progress converting all five Android views to real SDK composables and correctly wiring events. Previously flagged P1 issues (inert fontFamily, unused isDark, non-functional SignIn onTap) are unresolved but explicitly deferred by the developer. The one new finding is a trivial typo (P2). Score is 4 rather than 5 to flag the known deferred gaps for completeness. android/src/main/java/com/youversion/reactnativesdk/views/YVPBibleTextView.kt — typo and hardcoded fontFamily; android/src/main/java/com/youversion/reactnativesdk/views/YVPBibleWidgetView.kt — isDark computed but unused Important Files Changed
Sequence DiagramsequenceDiagram
participant JS as React Native (JS/TS)
participant Host as PlatformHost (AndroidHost)
participant Module as RN*Module (Expo DSL)
participant View as @Composable View Fn
participant SDK as YouVersion Platform SDK
JS->>Host: render BibleTextView bibleReference onPress
Host->>Module: props via ComposeProps
Module->>View: YVPBibleTextView(props, onTap)
View->>SDK: BibleText(reference, textOptions, onVerseTap)
SDK-->>View: user taps verse → BibleReference
View-->>Module: onTap(VerseTappedEvent(reference))
Module-->>JS: onTap event dispatched to JS
JS->>Host: render VotdView isCompact=false
Host->>Module: VotdViewProps
Module->>View: YVPVotdView(props, onSharePress, onFullChapterPress)
View->>SDK: VerseOfTheDay(bibleVersionId, dark, onShareClick, onFullChapterClick)
SDK-->>View: user taps share
View-->>Module: onSharePress(Unit)
Module-->>JS: onSharePress event dispatched
Reviews (3): Last reviewed commit: "chore: update default Bible version to 3..." | Re-trigger Greptile |
| @Composable | ||
| fun YVPBibleTextView(props: BibleTextViewProps, onTap: () -> Unit) { | ||
| BibleText( | ||
| reference = bibleReference(props), | ||
| textOptions = textOptions(props) | ||
| ) | ||
| } |
There was a problem hiding this comment.
onTap callback is never forwarded to BibleText
The onTap: () -> Unit parameter is accepted by YVPBibleTextView but is silently dropped — it is never passed to the underlying BibleText composable. As a result, the onTap event wired up in RNBibleTextViewModule will never fire for JS consumers.
If BibleText exposes a tap/click parameter, it should be passed through here. If it doesn't, this parameter (and the corresponding Events("onTap") declaration in the module) should be removed until the SDK supports it.
There was a problem hiding this comment.
I wasn't sure about implementing it in this PR because of some difference between what Kotlin and Swift have, but I've decided to add at least the base here: e89f49a
| fun YVPSignInWithYouVersionButton( | ||
| props: SignInWithYouVersionButtonProps, | ||
| onTap: () -> Unit | ||
| ) { | ||
| SignInWithYouVersionButton( | ||
| mode = mode(props), | ||
| stroked = stroked(props), | ||
| shape = shape(props), | ||
| dark = isDark(props), | ||
| permissions = { HashSet() } | ||
| ) | ||
| } |
There was a problem hiding this comment.
onTap callback is never forwarded to SignInWithYouVersionButton
The onTap: () -> Unit parameter is accepted but never used when calling SignInWithYouVersionButton(...). The onTap event dispatched from RNSignInWithYouVersionButtonModule will therefore never reach JS consumers — effectively making the button's tap event non-functional on Android.
If the SDK's SignInWithYouVersionButton exposes an onClick or similar parameter, wire onTap through to it. If it currently doesn't, this should be documented and the Events("onTap") declaration in the module should be deferred until it's supported.
There was a problem hiding this comment.
@sidorchukandrew I think this one is legit also
There was a problem hiding this comment.
I personally think we can leave this as is, because we'll be updating it shortly with the auth work Brenden did. If you'd like, I can add some short-lived documentation like greptile said.
android/src/main/java/com/youversion/reactnativesdk/views/YVPBibleTextView.kt
Show resolved
Hide resolved
android/src/main/java/com/youversion/reactnativesdk/views/YVPBibleTextView.kt
Outdated
Show resolved
Hide resolved
| @Composable | ||
| fun isDark(props: BibleWidgetViewProps): Boolean { | ||
| return when (props.colorScheme.value) { | ||
| "dark" -> true | ||
| "light" -> false | ||
| else -> isSystemInDarkTheme() | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
isDark is defined but never used
The isDark(props: BibleWidgetViewProps) composable function is defined and computes the dark/light theme from props.colorScheme, but BibleCard(...) is called without a dark (or equivalent) parameter. The colorScheme prop accepted from React Native has no effect on the rendered widget.
Either pass the result of isDark(props) to BibleCard once it supports a dark parameter, or remove this function until it can be wired up.
There was a problem hiding this comment.
Yes, the Kotlin side may need to implement this or we scrap this altogether for Swift too. Or we say it's an iOS-only prop.
camrun91
left a comment
There was a problem hiding this comment.
A few changes and the greptile issues look legit too.
src/components/BibleWidgetView.tsx
Outdated
| <Host matchContents={MATCH_CONTENTS} style={[styles.wrapper, style]}> | ||
| <PlatformHost | ||
| matchContents={MATCH_CONTENTS} | ||
| style={[style, styles.wrapper]} |
There was a problem hiding this comment.
These are flipped, this one will always take the styles.wrapper
There was a problem hiding this comment.
I thought I already fixed this somewhere 🤔 Either way, fixed here: 096df82
src/components/VotdView.tsx
Outdated
| <Host matchContents={MATCH_CONTENTS} style={[styles.wrapper, style]}> | ||
| <PlatformHost | ||
| matchContents={MATCH_CONTENTS} | ||
| style={[style, styles.wrapper]} |
There was a problem hiding this comment.
Same as above, this will always take the styles.wrapper
| fun YVPVotdView(props: VotdViewProps, onSharePress: () -> Unit, onFullChapterPress: () -> Unit) { | ||
| if (props.isCompact.value == true) { | ||
| CompactVerseOfTheDay( | ||
| bibleVersionId = props.bibleVersionId.value ?: 111, |
There was a problem hiding this comment.
The default version has changed to 3034
Description
This brings the Android side of the RN SDK up to date with the Swift SDK. There are still a few UI bugs that occur when the components load. However, those can be tackled in future work.
Type of Change
feat:New feature (non-breaking change which adds functionality)fix:Bug fix (non-breaking change which fixes an issue)docs:Documentation updaterefactor:Code refactoring (no functional changes)perf:Performance improvementtest:Test additions or updatesbuild:Build system or dependency changesci:CI configuration changeschore:Other changes (maintenance, etc.)Checklist