![]() |
VOOZH | about |
React Native lets developers build cross-platform mobile apps in JavaScript, running on both Android and iOS while combining web and native development.
React Native is an open-source framework developed by Facebook that enables developers to create mobile apps with JavaScript and React.
React Native uses multiple threads to manage the tasks involved in running an app. The main threads are:
The UI Thread (or Main Thread) handles rendering the app’s interface on Android and iOS, ensuring it stays responsive and visually smooth.
The JS (JavaScript) Thread runs the app’s logic, handles API calls and events, and coordinates with the UI Thread to update the interface smoothly at high frame rates.
The Native Modules Thread handles calls to platform-specific APIs, enabling React Native to access native features like camera or GPS from JavaScript.
In Android (specifically for version L and later), the Render Thread is responsible for generating OpenGL commands used to draw the UI. The Render Thread enables the app to efficiently render graphics and images on the screen.
React Native works by following a sequence of processes from app startup to rendering:
On app startup, the main thread is used for executing and loading the JavaScript bundles. The JS bundles have the app's logic and UI components.
After the successful loading of the JavaScript bundle, the JS Thread takes over the execution. This enables the JS Thread to execute the heavy computations without influencing the UI Thread, which keeps the user interface responsive.
React Native employs Reconciliation to effectively render UI updates. The Reconciler then contrasts the current virtual DOM with the new virtual DOM ("diffing"), and where there are updates to be made, sends them off to the Shadow Thread.
The Shadow Thread determines the layout of the UI components and passes the layout parameters to the UI Thread. "Shadow" in this case is the virtual UI that is created during this calculation. The layout consists of position, size, and other characteristics of UI components.
As only the UI Thread is allowed to display UI on the screen, the layout data computed by the Shadow Thread is dispatched to the UI Thread. The UI Thread renders the final result on the screen and displays it to the user.
React Native can broadly be divided into three primary parts:
The native side comprises the native modules and views that belong to the Android or iOS platform. It contains features such as the native UI and platform-specific APIs.
The JS side is where the JavaScript code executes. This is the code you, as a developer, write using React and JavaScript. It handles app logic, state, events, and UI rendering.
The Bridge enables asynchronous communication between JavaScript and native code, allowing data, events, and updates to pass without blocking either thread.
Must Read: