5 min to read
Expo is a framework/ platform for React applications providing a set of tools built around React Native and native platforms. It helps developers build, deploy, develop and quickly iterate on iOS, Android, and web apps from the same JavaScript/TypeScript codebase.
Are you planning to eject expo from your react-native app? If yes, I hope the following are the use cases that you’d have.
1- You want to add an “NPM” package to your project which requires a react–native link. And as a rule of thumb, if the documentation for a third-party package states that you need to run the command react-native link as part of the setup process, then this package can’t be used with the expo.
2- You are more of a native (Java/Kotlin/Swift/Objective C) person, and want to integrate a native module into your React–native app but couldn’t find a way to do it in the expo, so want to get rid of it?
3- You want to add an awesome push notification library like OneSignal in your app which expo doesn’t support.
Are there some other reasons? If yes, write in the comment box below, and I’ll personally look and reply.
Once you eject the expo, you can’t inject it back. So, all the great development experience that you had with the expo is gone now. Typically developing a feature in a non-expo takes almost 3x the time as compared to an expo.
If the developer chooses to eject from Expo, these great development features of the Expo are lost and it takes almost 3x the time as compared to the expo to develop those features in the non-expo state.
Expo is a kind of extension to React Native that offers a bunch of components and libraries already included to facilitate the development of mobile apps with React Native. Let’s see a few of them:
The expo team regularly updates the SDK with new solutions which is very useful for the user.
1. Want to add an “NPM” package that requires linking: The thing that you should ask yourselves is, are there some other packages that don’t require linking and still solves the purpose? Most of the time, you’d find that such a solution already exists. The Expo community has already included many useful packages in the build and the users are just not aware of it. Be it SVGs, animation, or video, most of the packages are already in the expo. If you couldn’t find the replacement package at the expo, then there is no way apart from the expo eject.
2. You want to add your written custom native module: When writing your react–native bridge of which the ‘NPM’ package doesn’t exist yet, for such a scenario the Expo eject is the only way and it has to be done.
3. Third-party notification library like OneSignal: Before integrating any awesome push notification service, you’d first explore the push notification service of the expo. Although Expo’s push notification service isn’t great it solves the purpose in most cases. If you don’t like it, and still want to integrate OneSignal or other notification services, then expo eject is the way out.
So far we have seen that in some of the cases, expo eject has to be done. And the expo itself says that. But wait, what if I tell you that there is a way in which you can add custom native modules to the expo without ejecting it?
Well, my above statement is not true. You have to eject it, but you won’t lose any of the benefits that you were getting with the expo. You can still use the modules provided by the expo, you can still have the same development flow, you don’t need to re-build native modules over and over again, and you don’t need to worry about pod files, swift, kotlin, etc.
Won’t that be great? In the following blog, I have described in detail how you can run the expo along with custom native modules, or simply do a react-native link with the expo
Read https://codersera.com/blog/running-expo-react-native-together/
You can eject expo by running the command npm run eject on the console.
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.
It helps you from the creation to the distribution of your React Native apps. Remember, when you are coding in Expo, you still write React Native code. But with the support of the Expo CLI and Expo Client on your smartphone. It is better to use Expo CLI if you are new to app development.
Tags
Are you looking for something specific?
We understand that hiring is a complex process, let’s get on a quick call.
Share
11 comments