Closed schmod closed 2 years ago
Aside: There's likely a similar conversation to be had regarding iOS and Swift. Unfortunately, that's a significantly more complicated topic, as ObjC/Swift are not as easily-interchangeable as Kotlin/Java are. (Unfortunately, this is especially true for many React Native integrations, as portions of the native module API are implemented via C compiler macros)
Thanks for raising this issue,
I'd also like to suggest modifying the documentation to make Kotlin the recommended choice for new projects, as this aligns with the general state of the Android ecosystem in 2021. Given the rapid proliferation of Kotlin throughout the Android community, React-Native's documentation feels outdated (and potentially confusing) for not even mentioning it.
As a rule of thumb, we would like to adapt our Android documentation to align with the industry standard (being Kotlin in this specific case). Over the next year, there will be efforts to revamp and adapt some of the examples/docs to offer Kotlin source snippets as well.
Adding Kotlin examples to R-N's documentation will improve accessibility and readability, as developers won't need to context-switch when comparing R-N's documentation to the official Android documentation.
Agree that will reduce the context-switching for users. On the other hand, this will increase our maintenance costs as we will have to make sure that both the Kotlin and the Java examples are updated.
👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions.
Closing as this became reality with:
Description
Kotlin has quickly gained traction in the Android community as an almost effortless drop-in replacement for Java. As of 2019, Kotlin is the officially preferred language for Android development.
To remain aligned with the broader community of Android developers, I would like to propose adapting React-Native's documentation to primarily provide code-samples in Kotlin when discussing native code on Android.
What is the problem?
Currently, nearly all of React Native's code-samples, documentation, and examples pertaining to Android Native code are written in Java.
How can we address it?
To reflect the current consensus of the Android developer community, I'd like to suggest adding Kotlin samples/examples alongside any Java samples/examples that currently appear in in the react-native documentation.
I'd also like to suggest modifying the documentation to make Kotlin the recommended choice for new projects, as this aligns with the general state of the Android ecosystem in 2021.
Given the rapid proliferation of Kotlin throughout the Android community, React-Native's documentation feels outdated (and potentially confusing) for not even mentioning it.
Many 3rd-party libraries and developer-documentation in the Android community have begun to take a "Kotlin-first" approach. Adding Kotlin examples to R-N's documentation will improve accessibility and readability, as developers won't need to context-switch when comparing R-N's documentation to the official Android documentation.
As a general note, Kotlin/Java interoperability remains excellent, and most source files can be converted from Java to Kotlin using an automated tool with few-to-no manual corrections required.
Also, Kotlin is more readable and concise! Take this Java example from the Android Native UI Component documentation:
can be rewrtitten in Kotlin as:
(Admittedly, this example features an incredibly obtuse API... but that's an issue for another ticket...)
Who needs this?
Android Devs
When should this happen (use version numbers if needed)?
It could happen at any time! I was able to convert my app and native modules to Kotlin using Android Studio's built-in conversion tool, and nearly everything "just worked." While the community could potentially investigate providing "Kotlin-friendly" APIs in the future, I believe that this could currently be a documentation-only change.
I've deliberately kept this ticket short and general, as I want to see if there's any appetite for this change before continuing further down this path.