applyNativeModulesAppBuildGradle(project) and applyNativeModulesSettingsGradle in gradle kts file

Viewed 896

I am using the Gradle KTS file and trying to set up the React native. I am not able to add

applyNativeModulesAppBuildGradle(project)

What is the alternative for applyNativeModulesAppBuildGradle in KTS. Also on settings, we have to write applyNativeModulesSettingsGradle

1 Answers

Below is my solution,calling applyNativeModulesSettingsGradle method in native_modules.gradle:

import groovy.lang.Closure

apply(from = "../node_modules/@react-native-community/cli-platform-android/native_modules.gradle")
val applyNativeModules: Closure<Any> = extra.get("applyNativeModulesSettingsGradle") as Closure<Any>
applyNativeModules(settings)

Use the Kotlin way to get the method reference from extra, then invoke the function.

Related