Course contentsShow
← React Native
Lesson 3 of 1,5551. The React Native ArchitectureFree lesson

Asynchronous Bridge Communication

You will be able to explain why React Native communication is inherently asynchronous and how it impacts event handling.

In this lesson, you will learn why React Native can’t process data instantly across the "Bridge" and how this changes the way you write your code.

The "Waiting Room" Reality

As we learned in the previous lessons, React Native runs your JavaScript on a separate thread from the native UI components. When the JavaScript side needs to talk to the native side (like asking it to open a camera or update a label), it sends a message across the "Bridge."

Because these two environments live on different threads, they cannot share memory directly. Every request must be serialized into a message, sent across the Bridge, and then deserialized on the other side. This process takes time—even if it's only a few milliseconds.

Because the JavaScript thread cannot "pause" its own execution to wait for a physical response from the native device, communication is inherently asynchronous. You send a request and move on, expecting the result to arrive later.

What This Means for Your Code

Since you don’t get an immediate return value from a native call, you cannot write code like this:

// This won't work!
const batteryLevel = NativeModule.getBatteryLevel(); 
console.log(batteryLevel); // You will get a Promise object, not the number.

Instead, you have to treat the communication like a text message conversation. You send a request, and you must "wait" for the answer to arrive via a callback or a Promise.

// This is how it works:
NativeModule.getBatteryLevel().then((level) => {
  console.log("The battery level arrived:", level);
});

Impact on Event Handling

Because communication is asynchronous, your UI might change slightly after an interaction occurs. If you click a button to change a background color, the JavaScript thread tells the Native thread to change the color. The UI doesn't update at the exact nanosecond of the click; it updates once the message travels across the bridge and is processed. This is why managing state in React Native relies on "snapshots" and updates, rather than direct, synchronous manipulation of native objects.

Key Takeaway: Because JavaScript and Native code live on different threads, they communicate by sending messages across the Bridge; you must always design your code to handle these responses asynchronously.