Introduction
What this article covers is the limitations of React Native. Some limitations are present in both iOS and Android as well as sometimes in one (sometimes the iOS and Android versions of a specific app are separate).
There’s a long way to go for React Native to overcome some performance-related limitations and challenges such as multithreading, parallel processing, Animations, scrolling lists, etc.
Facebook Doesn’t Want You to Know The Limitations of React Native Below
You can’t possibly compete in today’s high-tech world when you fall behind with the demand for high-quality UI and UX around the globe. If you want to take your business to the next level and make it grow exponentially, you have to seriously reconsider using React Native.
Instead of taking a traditional approach towards application development which will result in a mediocre application that suffers from performance limitations, take into consideration that the programming language and development framework that you are using offers a strong alternative.
React Native’s Performance Limitations
UI responsiveness is a key metric for success for any dashboard app. To ensure a fast and responsive UI, it’s necessary to make the dashboard seem as simple as possible by displaying as few widgets as possible.
Users have difficulty reading the many columns and rows of text that are required to display all of the information that a dashboard app may have.
Widgets are a great way to organize information and display it in a way that users easily understand, but it can feel difficult and overwhelming when too many widgets are being displayed on the screen at once.
Up to this point, we are just exposing just one web view. And when we do so, we aren’t making any attempt to make this view run on multiple threads.
For example, if you’re building a dashboard app, then using the React Native Page Class will render this part of the page concurrently on multiple threads to keep the UI responsive.
But what if we wanted to display multiple widgets and we also want this to be at the same time displayed on multiple threads?
Multithreading
When a mobile device has multiple cores, you can put 4-8 cores in that device and send all of them to a single screen to process one button. Multithreaded application is easy, but it’s not easy in native mobile applications, you’ll need to use some real-time libraries like Struts2 or Apache Thrift.
To be precise, when using React Native with two or more threads, React Native would occasionally and unpredictably stop on a stack trace and hang for a couple of seconds to get better performance.
Then it will take almost a minute to reconnect again to the app. So, if you have ten like threads, you may have about 20 hangs. This would mean that you are out of the app for nearly thirty seconds. It’s an unavoidable downside of React Native. There’s nothing you can do about this limitation.
On iOS and Android, you need to treat the UI elements as a memory buffer. It can keep temporary information between the threads and get a newly active state in between. The battery life is not spared either. So, React Native is not so ideal to be used on a high-performance device, such as an iPhone X.
Dependence on Third Party Libraries
React Native is an awesome framework, but because of the third-party library, it causes performance problems. Performance issues make people switch to native development or choose another framework like PhoneGap or Ionic. And if your business relies on React Native, losing customers will certainly be significant damage to your revenue.
To fix this problem, you only need to cache the already installed libraries with the react-native-library-cache module. The rest of your application will run smoothly because you can still use the third-party libraries without any performance issues!
Not every developer can build an app on his own. This is why there are many third-party libraries (called ‘view’.) And this fact tends to draw the main limitation of React Native.
Although you can use these libraries without modifying the original code, this will cause most of the performance issues.
In addition to the framework limitations, a developer needs to keep in mind the timing issues between your applications and the outside world. Most of the time developers will need to keep one or several networking conditions under control to get better performance.
Abstraction Layer Limitations
While React Native’s abstraction layer is meant to improve performance, many developers find it to be a low performer, often leading to buggy apps.
Due to the common issues with this framework, most companies are reluctant to adopt React Native into their portfolio. JavaScript is a way better option for your app needs.
It is a fast cross-platform development platform that provides high performance, speed, stability, and scalability for mobile application development. JS improves developer productivity by providing clean code and minimizing complexity.
When talking about performance issues, I think that the “abstraction layer” that was introduced by React Native developers has been a big obstacle for many developers. It provides a highly simplistic, transparent framework, with way too many complexities to deal with.
React Native hides everything for you and you end up with implementation details that are very difficult to understand and debug.
What’s worse, React Native goes even further to mask many performance issues, without any kind of apparent reason or rationale. It is a common problem that React Native has many hidden factors.
Animations
One of the biggest issues with React Native performance problems (sometimes) is Animation. While using React Native we deal with view animation in which view is defined as a function.
But what we are not able to do is in-line animation the way it is with JavaScript code by defining a function that will do the animation for us. With React Native, we can’t define the view that will do the animation. So, we need to deal with many variants of “Inline” animations.
This is the limitation of React Native Animations API. We have many custom View APIs. One of them (React Native Animations Platform) is not performant. It is slow, and it is easy to handle. For example, when we are using an Animated UI element, they are slow. But we still need them as they help us avoid dealing with animations.
Initialization Times
Any JS code must be parsed and executed in the JS Virtual Machine. This has a cost, and binary loading and compiled programs will always win. There may be some ways to enhance this, such as bytecode caching, but it appears to be a long way off.
The usage of emulators and tutorials during the initial setup was known to cause poor performance. But, React Native improves it constantly with each passing day.
React offers an initial setup wizard which generates the basic React Native application in a single click. However, to be successful with React Native, you need to be familiar with its challenges and limitations.
So, as soon as you create the React Native application, make sure to perform checks. The code is compiled down to bytecode by the Google V8 engine. Since it was compiled by the browser, it won’t work with regular JS runtimes like Webpack or Browserify.
So this can’t be used for minified/optimized JavaScript code. Because of all these limitations, React Native framework does not seem promising to push further the way people have to code for iOS and Android.
Scrolling Lists
Scrolling lists in React Native is best avoided. I know I just said to avoid the common problem but I still see developers throwing together a workaround instead of using the native navigation system.
The solution will be to do a proper full-screen scrolling of all elements and view the list as below: (View large version) Nothing wrong with that solution, but still, it’s a temporary fix. First, let’s understand the concept behind this particular navigation system.
All list items are scrolled in the direction of their beginning. Therefore, if a list item has multiple levels (such as a dashboard view), the navigation system must keep scrolling the list of items within those levels. And if that doesn’t happen then each level becomes a separate list item.
Android Deployment is not Easy on React Native
Different from the iOS deployment, for Android, we need to test it before deployment. For iOS, we just need to create a brand-new project and fill it with files from Xcode.
Android deployment is always a big issue for everyone, and it’s complicated and full of troubles. So many problems that we might encounter while deploying Android applications— the app crashes on the simulator or device, there is no sound in some devices, and so on.
The problem with Android is that you get one chance to get your app right or your customers will uninstall your app within seconds! That’s why you should use an emulator for iOS and Android platforms
Android deployment is not as easy as iOS deployment, so you need to test before deployment. For iOS, we need to create a brand-new project for iPhone, iPad, and iPod Touch with iCloud, then we need to fill it with files from Xcode.
After that, we need to connect all the devices to Mac and manually upload them to Apple’s servers. If you have an Android app, your app will hardly be popular if it’s limited to only one device family. You have to write for all devices. If you develop apps on Windows, they will never be popular if it’s limited to only one platform family.
Conclusion
React Native is a JavaScript framework that provides the capability of creating mobile apps using only JavaScript. It is one of the most popular frameworks for mobile app development. The framework does not require learning new languages or creating an entirely new app for different platforms; thus, it has become popular among iOS and Android developers.
However, React Native has its limitations too. For instance, it does not support web components that are becoming more and more popular in the JavaScript development world. That’s why replacing React Native with other frameworks like Pega or VueJS might be a good idea in the future where web components are gradually taking over the web platform itself.