Skip to content

Commit d9bca2d

Browse files
feat: add support for configure in Kotlin (#16)
* chore: enable Jetpack Compose for SDK * feat: add support for `configure` in Kotlin
1 parent 00cd31e commit d9bca2d

3 files changed

Lines changed: 36 additions & 1 deletion

File tree

android/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ version = '0.7.2'
55

66
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
77
apply from: expoModulesCorePlugin
8+
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
89
applyKotlinExpoModulesCorePlugin()
910
useCoreDependencies()
1011
useExpoPublishing()
@@ -37,7 +38,20 @@ android {
3738
versionCode 1
3839
versionName "0.7.2"
3940
}
41+
buildFeatures {
42+
compose true
43+
}
4044
lintOptions {
4145
abortOnError false
4246
}
4347
}
48+
49+
dependencies {
50+
implementation 'androidx.compose.ui:ui-android:1.9.1'
51+
implementation 'androidx.compose.foundation:foundation-android:1.9.1'
52+
implementation 'androidx.compose.material3:material3-android:1.3.2'
53+
54+
implementation 'com.youversion.platform:platform-core:0.5.0'
55+
implementation 'com.youversion.platform:platform-ui:0.5.0'
56+
implementation 'com.youversion.platform:platform-reader:0.5.0'
57+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.youversion.reactnativesdk
2+
3+
import com.youversion.platform.core.YouVersionPlatformConfiguration
4+
import expo.modules.kotlin.modules.Module
5+
import expo.modules.kotlin.modules.ModuleDefinition
6+
7+
class RNYouVersionPlatformModule : Module() {
8+
override fun definition() = ModuleDefinition {
9+
Name("RNYouVersionPlatform")
10+
11+
Function("configure") { appKey: String ->
12+
val context = appContext.reactContext
13+
?: throw IllegalStateException("ReactContext is not available yet")
14+
15+
YouVersionPlatformConfiguration.configure(
16+
context = context,
17+
appKey = appKey,
18+
)
19+
}
20+
}
21+
}

expo-module.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"platforms": ["apple", "android"],
3-
"features": ["swiftui"],
3+
"coreFeatures": ["swiftui", "compose"],
44
"apple": {
55
"modules": [
66
"RNYouVersionPlatformModule",

0 commit comments

Comments
 (0)