Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[META] Kotlin in React Native #19991

Closed
dulmandakh opened this issue Jul 1, 2018 · 14 comments
Closed

[META] Kotlin in React Native #19991

dulmandakh opened this issue Jul 1, 2018 · 14 comments
Labels
Contributor A React Native contributor. Partner Platform: Android Android applications. Resolution: Locked This issue was locked by the bot. Type: Discussion Long running discussion.

Comments

@dulmandakh
Copy link
Contributor

dulmandakh commented Jul 1, 2018

For Discussion

Kotlin is a rising start in Android Development, because it easy to learn and supports Java interoperability. Adding Kotlin to RN might make contribution easier and grow RN Android community, features.

Gradle and Buck both support Kotlin.

Let's talk about adding Kotlin to RN.

@dulmandakh dulmandakh added Type: Discussion Long running discussion. Core Team Platform: Android Android applications. labels Jul 1, 2018
@dulmandakh
Copy link
Contributor Author

As for myself, I can implement features in Kotlin, but not proficient enough to write large chunk of code in Java. Kotlin is safer because it handles nullability very well.

FYI, Okio project switched to Kotlin.

@gengjiawen
Copy link
Contributor

For me, kotlin has some awesome feature, but still need some more time. And for the iOS part, react native still stick to oc instead of swift.

@dulmandakh
Copy link
Contributor Author

During WWDC 18, Apple announced that Swift ABI becoming stable and Swift runtime will be included in OS in 2019, so apps don't have to embed Swift runtime.

@gengjiawen
Copy link
Contributor

Swift has been out for 4 years, and still not much adopted from my exerience. Kotlin became android dev language officially by google is just happened last year.

My point is this can wait. Okio switched to kotlin, but not okhttp, not retrofit, not rxjava.

@dulmandakh
Copy link
Contributor Author

dulmandakh commented Jul 3, 2018

@gengjiawen IIRC, Kotlin has been around for more than Swift, and it got adopted to Android last year because developers started using it since the beginning and asked for official support. Google IO18 showed more and more developers use Kotlin.

I would like to hear more from Facebook developers, managers: @hramos @mdvacca @sophiebits

@sophiebits
Copy link
Contributor

We don't have any plans to support Kotlin directly in the React Native upstream project, but if there are generic changes to RN that would make it easier to use alternative languages I'd say we'd be open to them.

@salah-ghanim
Copy link

From personal experience Kotlin is delight to work with compared to java and any decent Android developer should be able to pick it up in days.

Aside from nullability checks, the language provide so many out of the box features that make the code less, more readable and have better support for functional programming.

Also with intellij IDE converting java source code to kotlin and the other way around is just an IDE action (it actually works) the only issues I noticed is that it doesn't handle annotations (meta programming) very well but it's never a blocker.

I'm more than happy to convert couple of the native modules to kotlin as an example.

But does RN project support gradle 4 / Android Studio 3? because I think it's critical to use kotlin out of the box.

@hramos
Copy link
Contributor

hramos commented Jul 3, 2018

@salah-ghanim there's an outstanding PR that should add Gradle 4 support once merged.

@dulmandakh
Copy link
Contributor Author

@sophiebits @hramos I created a PR to add null annotations to few Java classes and interfaces to make them work better Kotlin, so it's easier and safer to develop native modules in Kotlin. #19973 (review)

@fungilation

This comment has been minimized.

@dulmandakh
Copy link
Contributor Author

Okio is rewritten in Kotlin https://medium.com/square-corner-blog/okio-2-6f6c35149525

@andylamax
Copy link

Being a kotlin dev, I think kotlinJS is production. KotlinJS makes kotlin react possible, so yes. I am down for kotlin react native as well

@hyochan
Copy link
Contributor

hyochan commented Jan 20, 2019

What I really hope from this issue is to make kotlin standalone react-native modules possible. I saw many developers working with react-native project building their own kotlin module and couldn't port to standalone libraries to npm.

I hope react-native team is aware that many of android developers are willing to provide firm open-source native modules built in kotlin and not java.

@hramos hramos added Core Team and removed Core Team labels Feb 1, 2019
@hramos hramos added Partner Contributor A React Native contributor. and removed Core Team labels Mar 8, 2019
@cpojer
Copy link
Contributor

cpojer commented Mar 19, 2019

I'm going to close this as we aren't planning on any larger rewrites like this at the moment. If you'd like to use Kotlin with React Native, that should be possible. If it doesn't work well, please send PRs that add support for various things that you need. If you'd like to mostly discuss this topic, please create a new issue in the discussions-and-proposals repository.

@cpojer cpojer closed this as completed Mar 19, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Contributor A React Native contributor. Partner Platform: Android Android applications. Resolution: Locked This issue was locked by the bot. Type: Discussion Long running discussion.
Projects
None yet
Development

No branches or pull requests

10 participants