What we covered in this article is about 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 in order to overcome some performance-related limitations and challenges such as multithreading, parallel processing, Animations, scrolling lists, etc.
Facebook Doesn’t Want You to Know These Limitations of React Native
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. That is what enables developers to build Android and iOS mobile apps using
React Native’s Performance Limitations
UI responsiveness is a key metric for success for any dashboard app. In order 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 is easily understood by users, 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 in order 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?
When a mobile device has multiple cores, you can actually 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. Basically, 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 in order to get better performance.
Abstraction Layer Limitations
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 really a common problem that React Native has many hidden factors.
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.
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.
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) then the navigation system has to 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 really 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.