Expo和React Native有什么区别? [英] What is the difference between Expo and React Native?

查看:835
本文介绍了Expo和React Native有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自世博会网站

Expo使Web开发人员只需用JavaScript编写一次即可构建真正可在iOS和Android上运行的本机应用程序.

Expo lets web developers build truly native apps that work across both iOS and Android by writing them once in just JavaScript.

这不是React Native的功能吗?有什么区别?

Isn't this what React Native does? What's the difference?

推荐答案

我在世博会工作!

Expo中编写代码时,您将编写React Native代码. Expo有 两个主要部分:

When you write code in Expo you write React Native code. Expo has two main pieces:

1)expo-cli:开发人员工具,用于创建项目,查看日志,在设备上打开,发布等.

1) expo-cli: a developer tool for creating projects, viewing logs, opening on your device, publishing, etc.

2)Expo客户端:手机上的一个应用程序,可让您打开项目 在您处理它们时,无需浏览XCodeAndroid Studio,并且还可以让其他人查看它们!而且,如果您通过expo-cli发布它,则用户只要登录到发布时使用的同一帐户,就可以随时通过Android或iOS上的Expo客户端访问它.最后,我们还使构建独立的应用程序成为可能,这样人们就不必使用Expo客户端打开它,并且可以根据需要分发到应用程序商店和Play商店.

2) The Expo client: an app on your phone that lets you open your projects while you're working on them, without needing to go through XCode or Android Studio, and also lets other people view them too! And if you publish it through expo-cli, people can access it at any time through the Expo client on Android or on iOS if signed in to the same account it was published with. Lastly, we also make it possible to build standalone apps so people don't have to use the Expo client to open it, and you can distribute to the app store and play store if you like.

因此,Expo是在React Native上/周围构建的一组工具.这些 工具取决于我们掌握在Expo上的一个主要信念:只要您拥有暴露给Javascript的全面的API集,就可以构建大多数应用程序而无需编写本机代码.

So, Expo is a set of tools built on top of / around React Native. These tools depend on one key belief that we hold at Expo: it's possible to build most apps without ever needing to write native code, provided that you have a comprehensive set of APIs exposed to Javascript.

这很重要,因为使用React Native您始终可以下拉至本机代码.有时候这很有帮助,但是却要付出一定的代价:如果您想让他们测试您的二进制文件,您需要将其发送给其他人,世界另一端的人不能只在工作时点击链接即可打开它就可以了,您不能一键发布它,就像别人在浏览器中一样访问它.

This is important because with React Native you can always drop down to native code. This is incredibly helpful sometimes but it comes at a cost: you need to send people your binaries if you want them to test them, someone on the other side of the world can't just tap a link to open it while you're working on it and you can't just publish it with one click for someone to access it similar to how you would in a browser.

对于Expo,我们建议尽量避免使用本机代码.如前所述,我们认为通过Javascript可用的一组全面的API,大多数应用程序都不需要这样做.因此,我们旨在提供这套全面的API,然后构建在本机运行时共享的世界中可能存在的所有出色工具.

With Expo, we suggest that try to avoid dropping down to native code, if you can. As I mentioned above, we think that with a comprehensive set of APIs available to Javascript, this shouldn't be necessary for most apps. So, we aim to provide this comprehensive set of APIs, and then build all of the awesome tooling that can exist in a world where the native runtime is shared.

但是,如果您必须确定绝对使用本机,则可以使用ExpoKit继续使用Expo为您提供的本机API,同时具有与任何本机项目一样的控制级别. "ExpoKit是Objective-C和Java库,允许您将Expo平台和现有的Expo项目用作较大的标准本机项目的一部分." 在此处了解更多信息.

However, if you must find that you absolutely drop down to native, you can use ExpoKit to continue using the native APIs that Expo gives you while having the same level of control as you would in any native project. "ExpoKit is an Objective-C and Java library that allows you to use the Expo platform and your existing Expo project as part of a larger standard native project." Read more here.

这篇关于Expo和React Native有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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