来自世博网站

Expo让web开发者只需用JavaScript编写一次,就能构建出能够在iOS和Android上运行的真正原生应用。

这不是React Native所做的吗?有什么不同?


当前回答

世博员工的回答和文件摘要:

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

其他回答

这里我要说明的是,Expo使用的是React的旧版本16.5,这将禁止你使用新的hooks功能。

如果您决定使用Expo,请注意您的版本控制。例如,如果遇到奇怪的错误,就需要在16.5版本中使用旧版本的反应导航。

世博员工的回答和文件摘要:

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

世博员工的回答和文件摘要:

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)

Expo是React Native CLI的包装,它在底层为开发人员提供方便。Expo解决的最常见的问题是,开发人员不必担心React Native CLI中经常出现的库链接问题。Expo现在提供了大量的库,这些库对健壮的开发非常有帮助。Expo的好处之一是,你可以在没有Mac的情况下通过Expo手机应用开发Android和iOS应用。

虽然它有很多好处,但使用Expo也有一些缺点:

应用程序的大小迅速增加。一个简单的Hello, World!app大小超过30mb 有时候,当你需要在你的应用程序中实现一些本地功能时,你将需要从Expo中弹出并返回React native CLI。而且您永远无法将其恢复到Expo CLI。

关于Expo和React Native CLI的优点和缺点的答案是完整的。我还想谈谈我的个人经历。

在项目中,默认情况下,Expo包含许多模块,这使得使用它更容易。但它在制作阶段存在一个大问题,因为Android和iOS版本的尺寸太大了。例如,如果你有一个带有“Hello, World!”’,APK文件大小约为19 MB。在React Native CLI中使用相同的项目将导致应用程序大小为6 MB。

所以就我个人而言,如果你想开发一款商业应用,我不建议你使用Expo。