admin管理员组文章数量:1352184
For my project I have the ReactNative project and Android project created separately. We create a bundle from RN project and save it at the required location in Android project for creating the build.
Now because of the above reason, I can't run CodeGen to create Spec file for the module. Is it a requirement to be able to create TurboModules or can I create a TurboModule without a schema as well.
I've created the below files to test this functionality:
class DemoTurboModule(reactContext: ReactApplicationContext): ReactContextBaseJavaModule(reactContext), TurboModule {
companion object{
const val NAME = "DemoTurboModule"
}
override fun getName() = NAME
@ReactMethod
fun logMessage(message: String) {
Log.d("MyTurboModule", message)
}
}
Package:
class DemoTurboPackage: BaseReactPackage() {
override fun getModule(name: String, context: ReactApplicationContext): NativeModule? {
if(name == DemoTurboModule.NAME){
return DemoTurboModule(context)
} else {
return null
}
}
override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
mapOf(
DemoTurboModule.NAME to ReactModuleInfo(
DemoTurboModule.NAME,
DemoTurboModule.NAME,
false,
false,
false,
true
)
)
}
}
本文标签: androidCan we create ReactNative TurboModules without running CodeGen schema generatorStack Overflow
版权声明:本文标题:android - Can we create ReactNative TurboModules without running CodeGen schema generator? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743853849a2550503.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论