I have a chance to contribute to a React Native mo...
# javascript
e
I have a chance to contribute to a React Native mobile project written in TypeScript. If it were written in my favourite language.... K..... then I might give it a go! I have no experience with RN/TS whatsoever, so I'd like to ask here: is there a way to add Kotlin/JS to an existing RN project? And can I then 'simply' start writing Kotlin, interacting with existing TypeScript files and the React Native SDK? Where do I get started? Do you know some good resources?
a
I am not sure that React Native makes any sense if you have Kotlin. What platforms are you targeting?
e
Android and iOS
I'm seriously considering a rewrite using KMM, but because the project already exists, I'm first considering adding Kotlin to it. It would make the project more accessible to me and other Kotlin devs
b
You certainly can, although it's not pretty. To achieve this you need to do the following: 1. Dump all your existing TS files in
src/main/resources
2. Via webpack.config.d flow add ts-loader webpack config 3. Declare your npm dependencies from package.json in gradle as
dependency(npm(<DEP>, <VERSION_BLOB>))
4. Start writing kotlin! 5. (Bonus) To get your TS autocompletion, emit type declarations for it and run #dukat tool to generate kotlin bindings
a
I am not an Android developer, but all reports I've heard state that KMM is much prefered to RN.
3
e
Thanks guys. I'll try this. Not sure how I'd benefit from it, because everything still would be written in TS, which would introduce likely unnecessary extraction / rewriting in Kotlin anyways. But for some cases this approach might be preferable over a rewrite in native Android/iOS, KMM, some other hybrid solution, or simply continuing development in RN/TS.