Does React Native compile JavaScript into Java for Android?

前端 未结 6 1333
再見小時候
再見小時候 2020-12-05 01:43

When I develop hybrid apps with React Native. Does the JavaScript code I write transform into Java-Code or Java-Bytecode for the Dalvik/ART Runtime when I create an Android-

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 01:54

    Basically, you write Javascript. The Javascript communicates with native components (Java on Android, Objective C on iOS, C# on Windows).

    The communication occurs through the so-called "bridge". If at any time you feel that this communication slows things down too much, you can choose to implement the Javascript functionality in Java, Objective C, or C# respectively in order to run purely native. In this case, you are writing directly in native code, so there's no Javascript to native compilation.

    This will sacrifice compatibility for performance. Normally, this is not necessary.

    • Further reading

    Understanding React Native bridge concept

提交回复
热议问题