Dieser Blogartikel ist älter als 5 Jahre – die genannten Inhalte sind eventuell überholt.
tl;dr it depends on your goals; react native can definitely be a tool to simplify your development for multiple platforms, or even just for one Platform if you don’t have too much knowledge of native development and your app is simple enough to work with only the APIs provided by React Native. There are also cases where you don’t need any native experience at all. But there are drawbacks.
What is React Native in comparison to web apps and native apps?
Basically React Native allows us to develop mobile apps with a native User Interface (UI) by using the web technologies React and JSX. But I will go into more detail in the following sections.
(Progressive) Web Apps
Fully Native Development
For most apps you need to code everything twice if you want Android and iOS users to get the benefits of your app. You use Objective-C or Swift for iOS and Java or Kotlin* for Android—with the exception of some C/C++ libs or the like with Android NDK or Objective-C in iOS. But you will most definitely need custom code for each Platform when it comes to the UI. This also allows you to use all the native UI Components which render and animate more smoothly than web apps most of the time.
While you can also write multi platform code with Kotlin for your Android and iOS Apps, we think it’s not ready for production yet. But we’ll have an eye on it.
With react native you will get something in between. You can use the same techniques as with React in the web, you can use JSX, just replace
<View></View> for example. Instead of CSS you can use the React Native Stylesheets which work similarly to CSS but different; for example there is no class hierarchy.
The main difference between a WebApp and React Native is the use of native UI components instead of HTML. React Native uses the same building blocks for the UI as any native code would. So you get the look, feel and performance (UI-wise) of a native app, because the UI is native.
Is it really native?
While we have native code for our platforms, not all views are really the views coming from the platform. For example a ReactTextView on Android is a
android.widget.TextView with some custom code but other views like ReactImageView do not extend the platform views. This can be an issue because you have to wait for new features or bug fixes happening in the platform code.
Antoher example ist the missing ripple effect on React Native buttons which is default in the Android native
AppCompatButton, although there is a workaround.
Maturity of React Native
Although React (
Native) itself is well matured and established in the web development community and React Native will celebrate its 3rd birthday next month, it has still no version 1.0. The current version as of this writing is 0.53. Martin Konicek, a core contributor to React Native, stated that they may bump a version 1.0 when they have a stable standard lib for navigation, but this statement is one and a half years old.
Development progresses kind of fast with more than one new version every month on average and the changes aren’t always backwards compatible, so you need reserve some time for React Native updates, otherwise you’ll be left behind.
The core team of React Native isn’t really interested in fixing bugs that do not affect apps developed by Facebook. Still, they say that pull requests are welcome. And while the documentation gets better for every new release, it’s still missing examples and good descriptions for a lot of components, so you need to try stuff to figure out how they’re working.
So who should use React Native and who shouldn’t? IMHO React Native can be a solution for everyone who wants to develop a not too complicated app for both platforms with a smaller budget and/or with a team that has a lot of web or React experience. You almost always need an experienced iOS developer or someone who is willing to learn how to create an App Store build with all the code signing stuff. Creating and publishing Android builds for the Play Store is a lot easier to learn compared to publishing an iOS application to Apple’s AppStore.
Because React Native is actively developed and changing quite a lot, you will need to make some time for React Native updates, so you won’t be left behind. If you want to create an app, and then pause developing it for some time, it can be a real pain to get back into development, because some things may not work as intended in newer versions of React Native, and plugins you might want to use might require newer versions of React Native. Native apps written in Objective-C or Java can pause for much longer and it’ll be less painful to restart development.
As I said in the introduction, it depends if React Native is more suited to you than native development. Maybe the following pros and cons can help you to make an informed decision:
Advantages of React Native
- React, as a widespread web framework
- one code base for both mobile platforms
- most of the times it’s easier to find web developers than native developers
- fast development with Hot-Reloading
- React is a well designed framework
- one team for both platforms
- synchronous development and releases for both platforms
Disadvantages of React Native
- with 3 years, it is still a young framework compared to the native frameworks for both platforms, which had more time to mature
- high maintenance, because of the possibility of breaking changes in minor releases
- you may need to wait some time for the support for new features on the platforms (like support for the iPhone X notch)
- React Native Components do not always comply with the Human Interface Guidelines of Apple or Material Design Guidelines of Google
- for more complex UI components and performance it still requires native knowledge