来自世博网站
Expo让web开发者只需用JavaScript编写一次,就能构建出能够在iOS和Android上运行的真正原生应用。
这不是React Native所做的吗?有什么不同?
来自世博网站
Expo让web开发者只需用JavaScript编写一次,就能构建出能够在iOS和Android上运行的真正原生应用。
这不是React Native所做的吗?有什么不同?
当前回答
Expo and React Native are two popular tools for building mobile apps, but they have some differences. Expo is a free and open-source platform that allows developers to quickly build apps with JavaScript and React Native. It provides a set of tools, libraries, and services that make it easier to get started with building a mobile app. React Native, on the other hand, is a framework for building mobile apps using React. React Native provides a more direct way to access native APIs and components, and allows for more customization and control over the app development process. In summary, Expo provides a faster and easier way to get started with building a mobile app, while React Native provides more control and customization.
Another difference between Expo and React Native is the deployment process. With Expo, you can publish your app directly to the app stores with just a few clicks. You can also take advantage of other services that Expo provides, such as push notifications and authentication. On the other hand, when building a React Native app, you'll need to use tools like Xcode or Android Studio to compile and package the app for deployment. Additionally, you'll have to handle the distribution process yourself, which can be time-consuming and complex.
在性能方面,React Native通常比Expo有更好的性能,因为它可以直接访问本地api和组件,而Expo依赖于它的SDK。然而,在许多情况下,性能差异可能并不显著。
总之,Expo和React Native都有各自的优点和缺点,它们之间的选择取决于项目的具体需求和目标。如果你刚刚开始移动应用程序开发,想要一个快速简单的方法开始,Expo是一个很好的选择。然而,如果你想要更多的控制和定制,React Native可能是更好的选择。
其他回答
我在世博工作了一年多。 如果应用的大小对你来说不重要,使用Expo,因为它比React-native更容易实现Map和Push,但在项目结束时,如果你想在谷歌Play或其他商店发布应用,你会遇到一个挑战,删除APK中的一些权限。
在React Native中,你可以改变一切,但对于导入一些库,如推送通知或地图,它也需要一些挑战,因为你必须手动将这些库添加到Android和iOS项目中。
这里我要说明的是,Expo使用的是React的旧版本16.5,这将禁止你使用新的hooks功能。
如果您决定使用Expo,请注意您的版本控制。例如,如果遇到奇怪的错误,就需要在16.5版本中使用旧版本的反应导航。
世博会CLI
优点:
无需安装Android Studio或Xcode即可开始构建。 不需要很多配置。 使用条形码扫描在Android和iPhone上轻松查看移动UI。通过在线iPhone和Android模拟器也更容易查看。 更快的设置和开发。
缺点:
无法添加本机依赖项。 创建。apk和。ipa文件是困难的。 apk/ipa的大小很大。
React Native CLI
优点:
轻松添加本机依赖项。 创建。apk和。ipa文件比使用Expo要容易得多
注意:React Native CLI是用来直接使用React Native框架的框架。
缺点:
需要高水平的配置。 基本了解Android和iOS文件夹结构。
如你所见,这两种方法各有利弊;您应该始终根据项目的需要来决定使用哪一种。
世博员工的回答和文件摘要:
React Native init: 优势
您可以添加用Java或Objective-C(可能是唯一但也是最强的一种)编写的本机模块。
Disadvantages Needs Android Studio and Xcode to run the projects You can't develop for iOS without having a Mac Device has to be connected via USB to use it for testing Fonts need to be imported manually in Xcode If you want to share the app you need to send the whole .apk / .ipa file Does not provide JavaScript APIs out of the box, e.g., Push-Notifications, Asset Manager, they need to be manually installed and linked with npm for example Setting up a working project properly (including device configuration) is rather complicated and can take time
世博会 优势
Setting up a project is easy and can be done in minutes You (and other people) can open the project while you're working on it Sharing the app is easy (via a QR code or link), you don't have to send the whole .apk or .ipa file No build necessary to run the app Integrates some basic libraries in a standard project (Push Notifications, Asset Manager, etc.) You can eject it to ExpoKit and integrate native code continuing using some of the Expo features, but not all of them Expo can build .apk and .ipa files (distribution to stores possible with Expo)
Disadvantages You can't add native modules (probably a game changer for some) You can't use libraries that use native code in Objective-C/Java The standard Hello World app is about 25MB big (because of the integrated libraries) If you want to use: FaceDetector, ARKit, or Payments you need to eject it to ExpoKit Ejecting it to ExpoKit has a trade-off of features of Expo, e.g. you cannot share via a QR code When ejecting to ExpoKit you are limited to the react-native version that is supported by ExpoKit then Debugging in ExpoKit (with native modules) is a lot more complicated, since it mixes two languages and different libraries (no official Expo support any more)
世博员工的回答和文件摘要:
React Native init:
优势
您可以添加用Java或Objective-C(可能是唯一但也是最强的一种)编写的本机模块。
缺点
Needs Android Studio and Xcode to run the projects You can't develop for iOS without having a Mac Device has to be connected via USB to use it for testing Fonts need to be imported manually in Xcode If you want to share the app you need to send the whole .apk / .ipa file Does not provide JavaScript APIs out of the box, e.g., Push-Notifications, Asset Manager, they need to be manually installed and linked with npm for example Setting up a working project properly (including device configuration) is rather complicated and can take time
Expo
优势
Setting up a project is easy and can be done in minutes You (and other people) can open the project while you're working on it Sharing the app is easy (via a QR code or link), you don't have to send the whole .apk or .ipa file No build necessary to run the app Integrates some basic libraries in a standard project (Push Notifications, Asset Manager, etc.) You can eject it to ExpoKit and integrate native code continuing using some of the Expo features, but not all of them Expo can build .apk and .ipa files (distribution to stores possible with Expo)
缺点
You can't add native modules (probably a game changer for some) You can't use libraries that use native code in Objective-C/Java The standard Hello World app is about 25MB big (because of the integrated libraries) If you want to use: FaceDetector, ARKit, or Payments you need to eject it to ExpoKit Ejecting it to ExpoKit has a trade-off of features of Expo, e.g. you cannot share via a QR code When ejecting to ExpoKit you are limited to the react-native version that is supported by ExpoKit then Debugging in ExpoKit (with native modules) is a lot more complicated, since it mixes two languages and different libraries (no official Expo support any more)
来源:
将Expo应用分离到ExpoKit:概念 react-native-init和create-react-native-app #516的区别 弹出到ExpoKit