React Native是否将JavaScript编译为Java for Android? [英] Does React Native compile JavaScript into Java for Android?

查看:125
本文介绍了React Native是否将JavaScript编译为Java for Android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用React Native开发混合应用程序时。当我从React Native代码创建Android-App时,我编写的JavaScript代码是否会转换为Dalvik / ART Runtime的Java-Code或Java-Bytecode?或者只是编译为本机UI组件的UI组件?或者像Fetch API这样的库是否将JavaScript代码编译成Java-Code或Java-Bytecode?

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-App from my React Native code? Or are just the UI components compiled into native UI components? Or does a library like the Fetch API compile the JavaScript code into Java-Code or Java-Bytecode?

推荐答案

基本上,你写的的JavaScript。 Javascript与本机组件通信(Android上的Java,iOS上的Objective C,Windows上的C#)。

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

通过所谓的桥接进行通信。如果您认为此通信过于缓慢,则可以选择分别在Java,Objective C或C#中实现Javascript功能,以便纯粹运行本机。在这种情况下,您直接在本机代码中编写,因此没有Javascript到本机编译。

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.

这篇关于React Native是否将JavaScript编译为Java for Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆