Building a mobile app in native is a piece of cake but to publish an app on the app store & play store, you probably need to work twice as hard and write the same feature in two different languages i.e Kotlin for Android and Swift for iOS. Solution? Hybrid app development.
What if we write one code that can be used for both Android and iOS? Yes, you heard that right. React-Native is designed purposely to support the ‘write once and deploy anywhere’ paradigm. It was launched in 2015 by Facebook and it took the mobile development world by storm. At VentureDive, we experimented with React-Native to develop a new product, Muslims by IslamicFinder. If you are developing a new product and are not sure whether to go for hybrid or native app development, here’s a guide by one of our mobile experts that will help you make an informed decision: Hybrid vs. Native Mobile Development: Which Is Better?
In this blog, I will shed some light on which CLI did we choose while developing Muslims app, and what were the reasons behind it. It will help you better understand how to go about choosing a CLI during hybrid app development.
Tools for hybrid app development using react-native
There are a lot of Integrated Development Environments (IDEs) out there that can be used for the development of React-Native apps. However, the most frequently used is Visual Studio Code. It’s a lightweight tool that can be used in systems with low RAM space. Other stable IDEs that are popular with the developers’ community are Atom and WebStorm.
Languages for react-native
The good thing about React is that it can be used with multiple languages. Moreover, if you are coming from a web development background, you can certainly use the knowledge of HTML and CSS with Flexbox – a CSS module defined to make better layouts – which is used for User Interface (UI) development. The main supported languages are Javascript and Typescript, which are really easy to understand for all developers regardless of which domain (web or mobile) they are experts in.
Selection of CLI
A Command Line Interface (CLI) is a visual interface where programmers can run commands to develop apps. Getting started with React-Native is a tricky thing since, in the beginning, you don’t have enough knowledge to make a CLI decision and this is the area where almost everyone makes a mistake. React-Native comes with two CLIs and you need to be absolutely certain about which one suits your requirements. The two CLIs are:
- Expo CLI
- React-Native CLI
Which CLI is better for hybrid app development?
That’s a million-dollar question and the answer lies within the overall requirements. There are certain limitations of both CLIs that could hamper your development efforts. If you choose to work with Expo CLI, you need to make sure that you understand its limitations and the same goes for React-Native CLI. While working on Muslims, a community engagement app by IslamicFinder, there were few requirements that were either not supported by Expo or it was not available with full configurational control. I have talked about them under ‘Expo Limitations’, below.
Expo limitations
When I started hybrid app development for Muslims, I wasn’t sure about which CLI I should choose but I knew one thing and that was: Expo makes it easier and faster to develop applications by handling all configurational changes, version conflicts, and certificates. It also signatures itself and provides a seamless way of deployment and debugging. That is all I needed as a newbie in React-Native to start, however, later I found out that Expo has some limitations as well:
- We cannot configure older versions of the Android/iOS operating system, for installation, using Expo.
- The executable size is large which can hurt the overall downloads.
- A lot of Firebase – a product by Google, that provides various services for app development – products are not supported by Expo, for instance:
- FCM, a Firebase service used for sending notifications to Android/iOS applications, is still not supported in iOS.
- Crashlytics, another Firebase service used to report crash events in the live environment, is not supported. Instead, you have to rely on Sentry, a paid tool for application monitoring and error tracking, for that.
- Video streaming player is available with very few configurable controls.
- Certain features cannot be tested on Expo’s client application. Instead, you need to make a build to test them. An example of such a feature is ‘Firebase Authentication’.
- Image caching libraries in Expo are not efficient enough to support apps like Instagram.
- You need to have a paid subscription for a faster build creation process, else you will have to wait for 45 to 60 minutes for the build, depending on the queue size.
- Realm, an external database, is not supported by Expo.
- If any native module is required to be plugged in then this is not a possibility in Expo.
- Things appear to be working fine in the Expo client app but they are not when compiled and built as a standalone app.
React-native CLI limitations
The first thing which is very important to note here is that once you have decided to migrate or eject from Expo CLI to React-Native CLI during hybrid app development, there is no turning back since it’s an irreversible process. The good thing about React-Native CLI is that it gives you complete freedom to implement any third-party plugins you want with the liberty to customize any implementation. You are not bound or restricted with any version of React-Native or minimum OS version handling and you are free to create builds at any time without any need of having a subscription to Expo servers. Saying this, you might face a few issues as well:
- You would have to handle Expo versions yourself along with managing all certificates and fingerprints.
- It will take extra effort to create builds for Android and iOS using their respective IDE’s where you will be handling all permissions and plugins using Gradle, a build automation tool for software development, for Android and Pods, a tool that manages dependencies and libraries, for iOS.
- Overall development time will increase since you will now have to consider dependencies separately.
- You will miss the Over The Air (OTA) feature for sure if you want to update or fix any important bug without publishing it and reflecting it on end-users’ devices. This feature allows the developers to modify something in the live users’ application.
- You will need MAC hardware for the iOS build creation process which isn’t required with Expo.
Conclusion
With React-Native, one can easily develop a hybrid app for both Android and iOS with the same lines of code. However, the selection of the CLI is dependent on the requirements and feature set that is to be implemented.
For beginners, I would recommend going with Expo since it will take a lot of your headache on itself, and later when you are more familiar with the React environment, you can always eject from Expo to Bareflow, which works similar to React-Native CLI but comes under Expo.
In my opinion, React-Native CLI gives you more freedom, liberty, and control to express and experiment over your code, whereas, Expo binds you in a shell where you rely more on Expo dependencies. The choice is yours depending on your level of React expertise.