Best practice for using Expo development builds while also having Testflight version - react-native

I'm building a React Native app and, because I'm working on payments, Expo recommends I use their development build methodology. This is working pretty well.
I am also beginning to push versions of my app to App Store Connect, to share them with specific testers via Testflight. This also works fine.
However, as the developer, I can't have both the development build and the latest Testflight version installed on my phone at the same time because they have the same name.
I'm curious what are best practices React Native developers have to get around situations like this. Is it renaming the development build version of the app to free up that namespace?

To install both at the same time you need to create your development clients with different bundle identifier. There is a guide for that here https://docs.expo.dev/build-reference/variants/.

Related

React Native CLI Setup for both IOS and android

I am trying to start a react native project using the React Native CLI method (https://reactnative.dev/docs/environment-setup). My first question is, if I have a mac and my friend has a windows computer can we both work on the same app? Also, how do I configure one single code base for both ios and android? Do I just follow the installation instructions for both in a single project? Thanks!
Yes, you can work separately on windows and mac for the same app and you don't have to configure any kind of codebase as react native is hybrid app development technology, you just have to write a single code for both the android and ios platforms.
To install react native CLI just follow the official document on your specific platforms because both of them have a slight difference in the installation process, after successful installation, I would suggest you to use some kind of VCS(Version controlling system) like git or svn.
I am also working in the same process as you have described I am developing in windows and my friend is working on the mac.
feel free to contact me I will help you if you have any kind of queries

Expo integration with Google Sign In

I am trying to add login via Google account to my application. I have encountered a problem. Expo offers two solutions.
Google (https://docs.expo.dev/versions/latest/sdk/google/) - This can only be used in a development environment. I have used it but it does not work in a standalone application, in my case it throws the error "redirect_uri_mismatch" /
GoogleSignIn (https://docs.expo.dev/versions/latest/sdk/google-sign-in/) - Doesn't work in the emulator so I can't add it to the application because I can't fix potential errors.
My question is what the hell library should I use?
I have already tried expo eject and use Google Sign In from React Native. However I got an error that Expo does not support custom native modules. Help!
Thanks in advance.
Edit: SDK 44 Release
With the release of SDK 44, expo-google-sign-in has now been deprecated in favour of expo-auth-session OR #react-native-google-signin/google-signin packages. If you want to use the latter, you will need to follow the custom development client path.
Pre SDK 44
We've implemented Google-Sign-In using the expo-google-sign-in library. Implementation is easy enough, but you will have to test using a standalone build of your application which is the only slightly annoying piece of the puzzle.
Building a standalone build is now even easier with EAS (not sure if you have an account - but if you don't, I would highly recommend it.)
I've used a GoogleSignIn library, but I also have pro tip for everyone who will implement it.
Instead of building a project every time when you will need to test it, you can build it once and then just use upadate OTA, it's much faster.

React Native, build for iOS

I have an app made with React Native that is already working on for Android.
I'm working on Debian 10.
For Android I build my app-release.aab file with this command:
bash android/gradlew --project-dir android --project-prop MYAPP_UPLOAD_STORE_FILE=my-key.keystore --project-prop MYAPP_UPLOAD_KEY_ALIAS=my-key --project-prop MYAPP_UPLOAD_STORE_PASSWORD=mypassword --project-prop MYAPP_UPLOAD_KEY_PASSWORD=mypassword clean bundleRelease
I've been creating this bundle for like a year with no problems, but now I have a task that is "now we want the iOS version"
What do I need to create this iOS version? I'm pretty lost, I have never created nothing for iOS, I just have this React Native app that works ok on Android.
I've been reading some mediums, youtube videos, and some questions here in Stackoverflow but they talk about that it's possible to create the app for both Android and iOS but I can't find a source of clear information about what I need for.
Do I need a Mac?
How should I create the bundle for iOS?
First, if you want to publish to the iOS app store, you need to buy a paid Apple Developer Program, regardless if you have a Mac or not.
Okay, if you have a Mac there is a good amount of documentation: https://reactnative.dev/docs/next/publishing-to-app-store and more. The below is if you do not have a Mac, or do not want to develop on it.
No Mac
You cannot build macOS apps locally without a Mac.
That being said, you could look at CI/CD, for example, Github Actions or Travis CI, as running macOS on them is possible. If you are already pushing your code to Github, I recommend Github Actions. If you do not want to use CI/CD, you can use Expo. With Expo, you can build your app on their servers, and all you need is a paid Apple Developer Program (no Mac).
With vanilla react-native for local development/builds you will need a Mac as Xcode (free) is required for iOS builds. It's propriety software to macOS. You will also need an Apple Developer account to setup development/distribution certificates for deployments.
You can then use Xcode and the iOS certificates/provisions to generate a bundle for iOS.

What is the difference between Expo CLI and React Native CLI? [duplicate]

From the Expo website
Expo lets web developers build truly native apps that work across both iOS and Android by writing them once in just JavaScript.
Isn't this what React Native does? What's the difference?
When you write code in Expo you are writing React Native code. Expo has
two main pieces:
Expo CLI (expo-cli): a developer tool for creating projects, viewing logs, opening on your device, publishing, etc.
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.
So Expo is a set of tools built on top of React Native. These tools depend on one key belief held 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.
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.
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.
However, if you must find that you want to drop down to native, you can use eject and continue using the native APIs that Expo gives you while having the same level of control as you would in any native project.
Read more about ejecting
A summary of the documentation and answers from Expo employees:
React Native init:
Advantages
You can add native modules written in Java or Objective-C (probably the only but the strongest one)
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
Expo
Advantages
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)
Sources:
Detaching Expo Apps to ExpoKit: Concepts
Difference between react-native-init and create-react-native-app #516
Ejecting to ExpoKit
The answer of Brent Vatne is fine, but I'd like to add some details.
Expo expands the API surface of React Native
React Native does not give you all the JavaScript APIs you need out of the box, but only most primitive features. React Native developers are expected to use Android Studio or Xcode to link additional native libraries.
Expo aims to enhance React Native and provide all the JavaScript APIs you need for the most common needs. It is basically a set of well-defined quality native libs already packaged for you in a single lib: ExpoKit. Sometimes these libraries are actually already existing in the React Native world, and integrated into ExpoKit.
It is also important to notice that the Expo team can't include every library out there into ExpoKit (which may create some frustration) because the Hello, World! app size would grow, as it would ship a lot of API's that wouldn't be used in most apps.
Expo provides over-the-air JavaScript updates
Like other systems (CodePush, etc.), Expo provides a system to update your app over the air. This means you upload your JavaScript bundle on a CDN and the mobile apps will automatically download and use the new JavaScript code on next startup (without requesting a publication/review from the stores).
Expo provides a CLI tool to upload/manage the JavaScript bundles on their CDN. For development you can also choose to become the CDN and host the JavaScript bundle on localhost. And Expo XDE is just a visual wrapper on the CLI.
Expo provides a generic client
The Expo client is a generic client that permits to load any app that is compatible with Expo. All the Expo apps do share the exact same native runtime (React Native + ExpoKit). The only difference is the JavaScript code that we give them. The Expo apps you publish to the app stores have your JavaScript bundle URL hardcoded in it. The Expo client is build in a specific way so that you can choose from which URL to load the JS, by scanning a QR code or providing a URL.
Note that this client can also load JavaScript bundles from localhost, and make your development experience easier: There isn't any need for Xcode or Android Studio, and it gets much faster to get your first Hello, World! app running on the phone (from hours to minutes). You can actually develop on an iPhone without a Mac and the setup takes two minutes.
Actually, as the Expo SDK can be upgraded, the Expo client includes a compatibility layer so that it is able to run the last five SDK versions.
Expo provides a build service
As all the Expo apps share the same native code, Expo is able to easily build these apps for you. They have created a cloud build service.
The major thing that differentiate two apps built by Expo is just the hardcoded URL to which the app is supposed to download the JavaScript bundle to run.
Expo does some other things for you, like providing a declarative way to setup app icons, orientations, permissions, API keys, helping you setup push notifications, provisioning profiles... many settings have to be hardcoded at build time in the app and can't be changed over the air.
Expo is to React Native what PhoneGap is to Cordova
React Native is similar Cordova. It is not the same view technology (native vs webview), but both allow you to control native features from JavaScript, and both offer a plugin system so that developers can easily add new JavaScript and native bindings.
PhoneGap is similar to Expo. They both try to enrich the raw API of the underlying platform they are built on with a predefined set of additional native plugins. PhoneGap also offers a build service and has a generic client that work as long as you use the approved plugins.
Conclusion
As you can see, Expo is a set of tools. At the end, it permits to easily develop, share and publish to the stores your mobile projects. It is quite similar to the PhoneGap experience (but a lot better and less confusing).
I will definitively recommend Expo for any new React Native greenfield project, except these two cases:
You already know you need API's that are not available in Expo and won't be anytime soon
You care a lot about your app size (Hello, World! is more than 25 MB due to the large size of ExpoKit, but after that it does not increase much as it is just JavaScript)
It is explained in the official Expo documentation
What is the difference between Expo and React Native?
Expo is kind of like Rails for React Native. Lots of things are set up for you, so it’s quicker to get started and on the right path.
With Expo, you don’t need Xcode or Android Studio. You just write JavaScript using whatever text editor you are comfortable with (Atom, vim, emacs, Sublime, VS Code, whatever you like). You can run XDE (our desktop software) on Mac, Windows, and Linux.
Here are some of the things Expo gives you out of the box that work right away:
Support for iOS and Android
You can use apps written in Expo on both iOS and Android right out of the box. You don’t need to go through a separate build process for each one. Just open any Expo app in the Expo Client app from the App Store on either iOS or Android (or in a simulator or emulator on your computer).
Push Notifications
Push notifications work right out of the box across both iOS and Android, using a single, unified API. You don’t have to set up APNS and GCM/FCM or configure ZeroPush or anything like that. We think we’ve made this as easy as it can be right now.
Facebook Login
This can take a long time to get set up properly yourself, but you should be able to get it working in 10 minutes or less on Expo.
Instant Updating
All Expo apps can be updated in seconds by just clicking Publish in XDE. You don’t have to set anything up; it just works this way. If you aren’t using Expo, you’d either use Microsoft Code Push or roll your own solution for this problem
Asset Management
Images, videos, fonts, etc. are all distributed dynamically over the Internet with Expo. This means they work with instant updating and can be changed on the fly. The asset management system built-in to Expo takes care of uploading all the assets in your repo to a CDN so they’ll load quickly for anyone.
Without Expo, the normal thing to do is to bundle your assets into your app which means you can’t change them. Or you’d have to manage putting your assets on a CDN or similar yourself.
Easier Updating To New React Native Releases
We do new releases of Expo every few weeks. You can stay on an old version of React Native if you like, or upgrade to a new one, without worrying about rebuilding your app binary. You can worry about upgrading the JavaScript on your own time.
But no native modules…
The most limiting thing about Expo is that you can’t add in your own native modules without detaching and using ExpoKit.
Expo CLI
Pros:
No need to install Android Studio or Xcode to start building.
Not a lot of configuration required.
Mobile UI to easily view on both Android and iPhone using barcode scanning. Also easier to view with online iPhone and Android simulators.
Faster setup and development.
Cons:
Native dependencies cannot be added.
Creating .apk and .ipa files is difficult.
Size of apk/ipa is huge.
React Native CLI
Pros:
Easily add native dependencies.
Creating .apk and .ipa files is much easier than with Expo
Note: React Native CLI is the framework to use to work directly with the React Native framework.
Cons:
High level of configuration required.
Basic knowledge of Android and iOS folder structure required.
As you can see, both approaches have their pros and cons; you should always decide which to use based on your needs for the project.
The answers about advantages and disadvantages of Expo and React Native CLI are complete. I want to mention another point as my personal experience.
Expo contains many modules by default in the project and it makes easier to work with it. But it has a big problem in the production phase, because the built Android and iOS versions have such a great size. For example, if you have a single page with a 'Hello, World!', the APK file size would be about 19 MB. Having a same project in React Native CLI will result in an app with the size of 6 MB.
So personally I do not recommend using Expo if you want to develop a commercial app.
I would make a note here that Expo is using an older version of React, 16.5, which would prohibit you from using the new hooks feature.
If you decide to go with Expo, be mindful to watch your version controls. Older versions of, say, react-navigation will need to be used with the 16.5 version if you are getting weird errors.
Expo is a wrapper of React Native CLI, which does things under the hood for the ease of developers. The most common problem that Expo solves is that the developer doesn't have to worry about the linking issues of the libraries that often occur in React Native CLI. Expo comes up with tons of libraries now that are extremely helpful for robust development. One of the benefits of Expo is you can develop an app for Android and iOS without having a Mac through Expo mobile application.
As it has tons of benefits, there are some cons of using Expo:
App size increases like hell. A simple Hello, World! app size is more than 30 MB
At times when you need to implement some native functionality into your app, you will need to eject from Expo and go back to React Native CLI. And you can never revert it back to Expo CLI.
I've experienced more than a year that works with Expo.
If the size of the app is not important for you, use Expo because it's easy to implement Map and Push easier than React-native, but at the end of the project, if you want to publish app in Google Play or another store, you have a challenge removing some permissions in your APK.
In React Native you can change everything, but for importing some library, such as push notification or the map, it needs some challenges too, because you have to add these libraries manually to Android and iOS projects.
A summary of the documentation and answers from Expo employees:
React Native init:
Advantages
You can add native modules written in Java or Objective-C (probably the only but the strongest one)
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
Expo
Advantages
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 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.
In terms of performance, React Native generally has better performance compared to Expo as it has a direct access to native APIs and components, whereas Expo relies on its SDK. However, the performance difference may not be significant in many cases.
In conclusion, both Expo and React Native have their own pros and cons, and the choice between them depends on the specific requirements and goals of your project. If you're just starting out with mobile app development and want a fast and easy way to get started, Expo is a great option. However, if you want more control and customization, React Native might be the better choice.

What is the difference between Expo and React Native?

From the Expo website
Expo lets web developers build truly native apps that work across both iOS and Android by writing them once in just JavaScript.
Isn't this what React Native does? What's the difference?
When you write code in Expo you are writing React Native code. Expo has
two main pieces:
Expo CLI (expo-cli): a developer tool for creating projects, viewing logs, opening on your device, publishing, etc.
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.
So Expo is a set of tools built on top of React Native. These tools depend on one key belief held 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.
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.
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.
However, if you must find that you want to drop down to native, you can use eject and continue using the native APIs that Expo gives you while having the same level of control as you would in any native project.
Read more about ejecting
A summary of the documentation and answers from Expo employees:
React Native init:
Advantages
You can add native modules written in Java or Objective-C (probably the only but the strongest one)
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
Expo
Advantages
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)
Sources:
Detaching Expo Apps to ExpoKit: Concepts
Difference between react-native-init and create-react-native-app #516
Ejecting to ExpoKit
The answer of Brent Vatne is fine, but I'd like to add some details.
Expo expands the API surface of React Native
React Native does not give you all the JavaScript APIs you need out of the box, but only most primitive features. React Native developers are expected to use Android Studio or Xcode to link additional native libraries.
Expo aims to enhance React Native and provide all the JavaScript APIs you need for the most common needs. It is basically a set of well-defined quality native libs already packaged for you in a single lib: ExpoKit. Sometimes these libraries are actually already existing in the React Native world, and integrated into ExpoKit.
It is also important to notice that the Expo team can't include every library out there into ExpoKit (which may create some frustration) because the Hello, World! app size would grow, as it would ship a lot of API's that wouldn't be used in most apps.
Expo provides over-the-air JavaScript updates
Like other systems (CodePush, etc.), Expo provides a system to update your app over the air. This means you upload your JavaScript bundle on a CDN and the mobile apps will automatically download and use the new JavaScript code on next startup (without requesting a publication/review from the stores).
Expo provides a CLI tool to upload/manage the JavaScript bundles on their CDN. For development you can also choose to become the CDN and host the JavaScript bundle on localhost. And Expo XDE is just a visual wrapper on the CLI.
Expo provides a generic client
The Expo client is a generic client that permits to load any app that is compatible with Expo. All the Expo apps do share the exact same native runtime (React Native + ExpoKit). The only difference is the JavaScript code that we give them. The Expo apps you publish to the app stores have your JavaScript bundle URL hardcoded in it. The Expo client is build in a specific way so that you can choose from which URL to load the JS, by scanning a QR code or providing a URL.
Note that this client can also load JavaScript bundles from localhost, and make your development experience easier: There isn't any need for Xcode or Android Studio, and it gets much faster to get your first Hello, World! app running on the phone (from hours to minutes). You can actually develop on an iPhone without a Mac and the setup takes two minutes.
Actually, as the Expo SDK can be upgraded, the Expo client includes a compatibility layer so that it is able to run the last five SDK versions.
Expo provides a build service
As all the Expo apps share the same native code, Expo is able to easily build these apps for you. They have created a cloud build service.
The major thing that differentiate two apps built by Expo is just the hardcoded URL to which the app is supposed to download the JavaScript bundle to run.
Expo does some other things for you, like providing a declarative way to setup app icons, orientations, permissions, API keys, helping you setup push notifications, provisioning profiles... many settings have to be hardcoded at build time in the app and can't be changed over the air.
Expo is to React Native what PhoneGap is to Cordova
React Native is similar Cordova. It is not the same view technology (native vs webview), but both allow you to control native features from JavaScript, and both offer a plugin system so that developers can easily add new JavaScript and native bindings.
PhoneGap is similar to Expo. They both try to enrich the raw API of the underlying platform they are built on with a predefined set of additional native plugins. PhoneGap also offers a build service and has a generic client that work as long as you use the approved plugins.
Conclusion
As you can see, Expo is a set of tools. At the end, it permits to easily develop, share and publish to the stores your mobile projects. It is quite similar to the PhoneGap experience (but a lot better and less confusing).
I will definitively recommend Expo for any new React Native greenfield project, except these two cases:
You already know you need API's that are not available in Expo and won't be anytime soon
You care a lot about your app size (Hello, World! is more than 25 MB due to the large size of ExpoKit, but after that it does not increase much as it is just JavaScript)
It is explained in the official Expo documentation
What is the difference between Expo and React Native?
Expo is kind of like Rails for React Native. Lots of things are set up for you, so it’s quicker to get started and on the right path.
With Expo, you don’t need Xcode or Android Studio. You just write JavaScript using whatever text editor you are comfortable with (Atom, vim, emacs, Sublime, VS Code, whatever you like). You can run XDE (our desktop software) on Mac, Windows, and Linux.
Here are some of the things Expo gives you out of the box that work right away:
Support for iOS and Android
You can use apps written in Expo on both iOS and Android right out of the box. You don’t need to go through a separate build process for each one. Just open any Expo app in the Expo Client app from the App Store on either iOS or Android (or in a simulator or emulator on your computer).
Push Notifications
Push notifications work right out of the box across both iOS and Android, using a single, unified API. You don’t have to set up APNS and GCM/FCM or configure ZeroPush or anything like that. We think we’ve made this as easy as it can be right now.
Facebook Login
This can take a long time to get set up properly yourself, but you should be able to get it working in 10 minutes or less on Expo.
Instant Updating
All Expo apps can be updated in seconds by just clicking Publish in XDE. You don’t have to set anything up; it just works this way. If you aren’t using Expo, you’d either use Microsoft Code Push or roll your own solution for this problem
Asset Management
Images, videos, fonts, etc. are all distributed dynamically over the Internet with Expo. This means they work with instant updating and can be changed on the fly. The asset management system built-in to Expo takes care of uploading all the assets in your repo to a CDN so they’ll load quickly for anyone.
Without Expo, the normal thing to do is to bundle your assets into your app which means you can’t change them. Or you’d have to manage putting your assets on a CDN or similar yourself.
Easier Updating To New React Native Releases
We do new releases of Expo every few weeks. You can stay on an old version of React Native if you like, or upgrade to a new one, without worrying about rebuilding your app binary. You can worry about upgrading the JavaScript on your own time.
But no native modules…
The most limiting thing about Expo is that you can’t add in your own native modules without detaching and using ExpoKit.
Expo CLI
Pros:
No need to install Android Studio or Xcode to start building.
Not a lot of configuration required.
Mobile UI to easily view on both Android and iPhone using barcode scanning. Also easier to view with online iPhone and Android simulators.
Faster setup and development.
Cons:
Native dependencies cannot be added.
Creating .apk and .ipa files is difficult.
Size of apk/ipa is huge.
React Native CLI
Pros:
Easily add native dependencies.
Creating .apk and .ipa files is much easier than with Expo
Note: React Native CLI is the framework to use to work directly with the React Native framework.
Cons:
High level of configuration required.
Basic knowledge of Android and iOS folder structure required.
As you can see, both approaches have their pros and cons; you should always decide which to use based on your needs for the project.
The answers about advantages and disadvantages of Expo and React Native CLI are complete. I want to mention another point as my personal experience.
Expo contains many modules by default in the project and it makes easier to work with it. But it has a big problem in the production phase, because the built Android and iOS versions have such a great size. For example, if you have a single page with a 'Hello, World!', the APK file size would be about 19 MB. Having a same project in React Native CLI will result in an app with the size of 6 MB.
So personally I do not recommend using Expo if you want to develop a commercial app.
I would make a note here that Expo is using an older version of React, 16.5, which would prohibit you from using the new hooks feature.
If you decide to go with Expo, be mindful to watch your version controls. Older versions of, say, react-navigation will need to be used with the 16.5 version if you are getting weird errors.
Expo is a wrapper of React Native CLI, which does things under the hood for the ease of developers. The most common problem that Expo solves is that the developer doesn't have to worry about the linking issues of the libraries that often occur in React Native CLI. Expo comes up with tons of libraries now that are extremely helpful for robust development. One of the benefits of Expo is you can develop an app for Android and iOS without having a Mac through Expo mobile application.
As it has tons of benefits, there are some cons of using Expo:
App size increases like hell. A simple Hello, World! app size is more than 30 MB
At times when you need to implement some native functionality into your app, you will need to eject from Expo and go back to React Native CLI. And you can never revert it back to Expo CLI.
I've experienced more than a year that works with Expo.
If the size of the app is not important for you, use Expo because it's easy to implement Map and Push easier than React-native, but at the end of the project, if you want to publish app in Google Play or another store, you have a challenge removing some permissions in your APK.
In React Native you can change everything, but for importing some library, such as push notification or the map, it needs some challenges too, because you have to add these libraries manually to Android and iOS projects.
A summary of the documentation and answers from Expo employees:
React Native init:
Advantages
You can add native modules written in Java or Objective-C (probably the only but the strongest one)
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
Expo
Advantages
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 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.
In terms of performance, React Native generally has better performance compared to Expo as it has a direct access to native APIs and components, whereas Expo relies on its SDK. However, the performance difference may not be significant in many cases.
In conclusion, both Expo and React Native have their own pros and cons, and the choice between them depends on the specific requirements and goals of your project. If you're just starting out with mobile app development and want a fast and easy way to get started, Expo is a great option. However, if you want more control and customization, React Native might be the better choice.