简体   繁体   English

kotlin 如何在 React Native 的 native 模块上调用 function

[英]How kotlin multiplatform call function on native module in React Native

I want to move JS logic to KMM but I want to reuse Native Library like react-native-async-storage.我想将 JS 逻辑移至 KMM,但我想重用原生库,如 react-native-async-storage。 How can I do that?我怎样才能做到这一点?

If it is a NPM module, then you should be able to use NPM libraries in Kotlin/JS.如果它是一个 NPM 模块,那么你应该可以在 Kotlin/JS 中使用 NPM 库。

https://kotlinlang.org/docs/using-packages-from-npm.html https://kotlinlang.org/docs/using-packages-from-npm.html

Note that you would need to write external declarations.请注意,您需要编写外部声明。 You can write it manually or use Dukat tool您可以手动编写或使用Dukat工具

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM