Last updated: May 15, 2020
React Native people rejoice: you can now add native capabilities to your RN Expo projects and use an Android or iOS workflow for them on Bitrise.
What is Ejecting to Expokit for?
If you created an Expo project and you want a way to add custom native modules, [you need] to use ExpoKit for that purpose.
Normally, Expo apps are written in pure JS and never "drop down" to the native iOS or Android layer. This is core to the Expo philosophy and it's part of what makes Expo fast and powerful to use.
However, there are some cases where advanced developers need native capabilities outside of what Expo offers out-of-the-box. The most common situation is when a project requires a specific Native Module which is not supported by React Native Core or the Expo SDK.
In this case, Expo allows you to eject your pure-JS project from the Expo iOS/Android clients, providing you with native projects that can be opened and built with Xcode and Android Studio. Those projects will have dependencies on ExpoKit, so everything you already built will keep working as it did before. (Source: Expo Docs)
Why would you do that on Bitrise?
You might want to eject your project from the respective Expo clients if your project needs a native module that Expo doesn't currently support. This happens especially if your app has very specific and uncommon native demands.
And most importantly, if you want to use the following steps on Bitrise: Xcode Archive & Export for iOS, Android Build, Deploy to Bitrise.io (and some more), you must eject your Expo project before with the new Expo Eject step.
How to use the step
Always use the latest version of the step!
It depends on whether you use the ExpoKit or not:
- If your project needs the ExpoKit, you must provide the username & password for your Expo account. Providing the username & password will cause the step to perform the “eject” with the “ExpoKit” option.
- If your project does not use the ExpoKit then you don’t need to do provide the username & password. The step will perform the “eject” with the “bare” option.
After the expo-eject step, you can use any of your Android or iOS workflows for your eject Expo project just like for any Android or iOS project.
Inputs needed for the step:
- Working directory: The root directory of the React Native project (directory that contains package.js)path of your project directory
- Expo CLI version: Specify the Expo CLI version to install. (Required)
- Username for Expo: Your account's username for https://expo.io/ . (Only if you want to use ExpoKit option for eject)
- Password for your Expo account: Password for your Expo account. (Only if you want to use ExpoKit option for eject”)
- Run expo publish after eject?: Should the step run `expo publish` after eject?
- React Native version to set in package.json: React Native version to set in the package.json after the eject is executed.
Happy building! 🚀