Use a third-party SDK
Add the pod or Gradle dependency to the app as usual, then import it from lucent:ios/* or lucent:android/*.
import { PLATFORM } from "lucent:platform";import { RCTAppDependencyProvider } from "lucent:ios/ReactAppDependencyProvider";import { ContextCompat } from "lucent:android/androidx.core.content";import { PackageManager } from "lucent:android/android.content.pm";import { appContext } from "lucent:android";
export async function linkedLibraries(): Promise<string> { if (PLATFORM === "ios") { const provider = new RCTAppDependencyProvider(); return `${provider.urlRequestHandlerClassNames().length} request handlers, ${provider.imageDataDecoderClassNames().length} image decoders`; } else { const internet = ContextCompat.checkSelfPermission(appContext(), "android.permission.INTERNET"); return `INTERNET granted ${internet === PackageManager.PERMISSION_GRANTED}`; }}A library the app already links is imported like the SDK: a pod's module on iOS, an AndroidX package on Android. This module is from the example apps, which add nothing for it.
Add a library
Section titled “Add a library”- Add it to the app as usual: a pod in
ios/Podfile, or a dependency inandroid/app/build.gradle. - iOS: run
pod install. Lucent reads the pods' headers from the app'sPodsfolder. - Android: nothing more.
lucent buildasks Gradle for the app's compile classpath, and caches the answer until the Gradle files change. - Import from
lucent:ios/<Module>orlucent:android/<package>.
- Swift Package Manager libraries can't be imported yet; CocoaPods ones can (roadmap).
- A library in a Lucent package goes in its
lucent.jsoninstead, so apps get it when they install the package.