Introduction
We make decisions every day. Most of them are insignificant like what to wear to the office, but some of them can make an actual difference (like choosing the right React development agency). The thing is that the number of possibilities is growing exponentially so making any decision becomes more and more difficult, let alone making the right one. And that's one of the reasons behind our blog – to make your life at least a little easier.
Today, we will talk about choosing the right framework for your cross-platform mobile application. This time, the choice is limited to React Native and Xamarin.
What is cross-platform mobile development?
Cross-platform development is an approach to build one mobile application for different operating systems, especially focusing on Android and iOS. This is opposed to native development which means building separate applications instead of just one.
Advantages of cross-platform apps
- They work on every device – you don't have to build separate applications for Android and iOS. Instead, you can hire one developer who will build you one application working on every device.
- Cost-effectiveness – as mentioned above, you will have to build one application instead of two, which means saving money. Also, fixing and improving the code of one application is cheaper.
- Shortened time to market – building two separate applications at the same time is highly time-consuming. Choosing a cross-platform application means getting MVP ready faster and a possibility to get the first clients as quick as possible. Or at least an honest feedback from them.
- Broader audience – cross-platform development allows you for reaching all users, regardless of the operating system they use, with a single app.
Cross-platform development vs native development
We already wrote a piece about this fight between cross-platform development and native development — you can read it here.
What frameworks are out there?
Let's say that you decided to go with the cross-platform app. The next step would be to choose a proper framework to build one; a framework that will suit your needs. Among the most popular frameworks are:
Since our first choice is React Native, we have been comparing it to other frameworks to help you make an informed decision. Until now, we compared React Native with Cordova and Ionic and React Native with Flutter.
And now it's time to present a comparison between React Native and Xamarin.
What is React Native?
React Native, as same as React.js, is a product of Facebook. It's an open-source framework based on JavaScript and JSX that you can use to build native mobile applications for both Android and iOS.
If you want to learn more about React Native, read our React Native Guide.
What is Xamarin?
Microsoft created Xamarin, an open-source app platform, to help .NET developers with building modern and performant applications for Android, iOS and Windows. Xamarin is responsible for managing communication between shared code and platform code.
Thanks to Xamarin, developers can share more or less 90% of their application across all major platforms. Such a possibility means that programmers can write all of their business logic using one language while achieving native-like feeling on each platform.
Developers can use either PC or Mac to write Xamarin applications and compile them into native application packages (.apk for Android and .jpa for iOS).
Companies using Xamarin
- Academy of Motion Picture Arts and Science
- American Cancer Society
- Azure
- BBC Good Food
- JustGiving
- Microsoft News
- UPS
React Native vs Xamarin: Head-to-head Comparison
React Native | Xamarin | |
Programming language | JavaScript | .NET with C# |
Created by | Microsoft | |
Supported platforms | Android, iOS, Web Apps | Android, iOS, UWP, PWF, MacOS |
Hot Reload | Yes | No |
Release date | 2015 | 2013 |
Pros and Cons of React Native
Pros | Cons |
Access to native features and functionalities like accelerometer or camera | Abandoned libraries and packages |
Easy to learn | Frequent updates are a pain in the ass |
Faster development process thanks to pre-installed elements | Inability to perform on multiple screens |
High-quality, native-like UI | React Native struggles with complex animations and transitions |
Hot Reload | Navigation is nothing like a native one |
Large and supportive community | React Native doesn’t ensure security for third-party plugins |
Live inspection of components | |
Open-source and free |
Pros and Cons of Xamarin
Pros | Cons |
Full hardware support (i.e. camera, GPS) | Familiarity with platform-specific code might be needed |
Compatibility with MVC and MVVM architectures | Minimal community support |
Complete development ecosystem (C#, .NET and Visual Studio) | Not a great choice for apps with complex UI |
Open-source and free | The large size of the application |
Simplified maintenance | UI development is time-consuming and not mobile-friendly |
The Xamarin Component Store which provides a lot of components |
React Native vs Xamarin: Development environment
React Native
Developers can use a text editor and IDE (integrated development environment) of their choice and among them are Atom, Sublime Text, Visual Studio Code. Additionally, they can use the Live Reloading feature to see changes in real-time.
Xamarin
Xamarin, on the other hand, is more developer-friendly. As a developer, you can write code for an iPhone app on Windows and compile it for Mac. Two development environments make the whole process easier in Xamarin than it is in React Native – Visual Studio and Apple’s XCode.
Visual Studio simplifies building mobile, desktop and web applications.
XCode is an IDE used to design applications for Apple TV, Apple Watch, iPad, iPhone and Mac.
Winner: Xamarin
React Native vs Xamarin: Code compilation
React Native
Just-in-time (JIT) compilation is available for Android but not for iOS since Apple prohibits executing dynamically generated code on its devices.
Xamarin
Because, as mentioned above, JIT compilation isn’t available for iOS, Xamarin has an even better alternative called AOT (Ahead-of-time) compilation. If code compilation were the only factor when deciding which framework to choose, both Android and iOS developers would choose Xamarin.
Winner: Xamarin
React Native vs Xamarin: Cost
React Native
React Native is an open-source project so everyone, including developers and companies, can use it freely without any cost.
Xamarin
Although Xamarin itself is also an open-source and free platform, enterprise users need to pay to use the Visual Studio.
Winner: React Native
React Native vs Xamarin: Performance
React Native
Three main factors are taken into consideration during a performance measurement: GUI, 64-bit support and fast code execution. React Native doesn’t offer support for 64-bit mode on Android, and it also shows the worst result while running the fastest code on iOS.
Xamarin
The framework from Microsoft fully supports 64-mode and allows for using native tools directly and thus provides the fastest user interface. Xamarin developers can run the fastest code on both Android and iOS platforms.
Winner: Xamarin
React Native vs Xamarin: Popularity
It’s always great to check the popularity of particular technologies to make sure there is enough interest from developers and other technical (and non-technical) people. And is there any better metric for this task than checking online search trends?
Here is the screen from Google Trends:
React Native is much more popular than Xamarin so we can expect that there will be more developers using it in the future and consequently, more support.
Winner: React Native
React Native vs Xamarin: Support
While Xamarin is two years younger than React Native, it doesn’t make any difference when it comes to the support from the developer community. It’s even on the contrary – React Native is much more popular and has significantly better support. But don’t take my word for it – check stats from GitHub.
React Native | Xamarin |
Winner: React Native