React-native和Cordova之间的技术差异 [英] Technological difference between react-native and cordova
问题描述
"react-native"和"Apache Cordova"之间的技术区别是什么?
What is the technological difference between "react-native" and "Apache Cordova"?
我已经在Cordova上工作了一段时间,它的工作方式是,它创建一个webview(无头浏览器)并在其中运行具有各种API访问权限的应用程序.我一直想知道反应本地"是否同样如此. "react-native"是否还会创建Webview?还是将javascript代码转换为本地代码?
I have been working with Cordova for a while now and the way it works is, it creates a webview (a headless browser) and runs the application inside of it with various API access. I have been wondering if same is true for "react-native". Does "react-native" also create webview? or does it convert javascript code to native code?
如果它创建像Cordova这样的"webview",那么"Cordova + React"应用程序和"react-native"应用程序(不包括react-native提供的本机组件)之间有什么区别?
If it creates a "webview" like Cordova, then what is the difference between a "Cordova + React" app and a "react-native" app (excluding the native-components that are provided by react-native)?
我知道这里已经有此类问题的答案:电话差距与React Native .但是我的问题有点不同.谢谢.
I know there is already an answer to this type of question here: Phone gap vs React Native. But my question is a bit different. Thank you.
推荐答案
"React-Native"是否还会创建Web视图?
Does "React-Native" also create webview?
不. React Native是为Android和IOS编写本机用户界面的抽象.您的Javascript代码在OS上的Javascript运行时中运行,但是UI呈现为本机组件.这使其与Cordova/PhoneGap完全不同.
No. React Native is an abstraction to write native User Interfaces for Android and IOS. Your Javascript code runs in a Javascript runtime on the OS, but the UI is rendered as native components. This makes it very different than Cordova/PhoneGap.
在 React Native网页中提及:
本地组件
使用React Native,您可以使用标准平台 组件,例如iOS上的UITabBar和Android上的Drawer.这给 您的应用程序与平台其余部分保持一致的外观 生态系统,并保持较高的质量标准.这些组件很容易 通过与他们的React组件相对应的功能集成到您的应用中, 例如TabBarIOS和DrawerLayoutAndroid.
With React Native, you can use the standard platform components such as UITabBar on iOS and Drawer on Android. This gives your app a consistent look and feel with the rest of the platform ecosystem, and keeps the quality bar high. These components are easily incorporated into your app using their React component counterparts, such as TabBarIOS and DrawerLayoutAndroid.