DEV Community

George Fean
George Fean

Posted on Originally published at bundledrop.app AI-assisted

React Native OTA Without Expo: Verify Your First Update

You can ship an over-the-air (OTA) update from a bare React Native app without adopting Expo. Keep your existing native projects, add an update client, and ship a native build that knows how to use it. That build can then accept compatible JavaScript and bundled assets.

A first release should prove something specific. Take an app you already have, change one line of JavaScript, and verify that the same installed binary runs the new bundle. For the Android example below, I’m using Bundle Drop, the OTA client I maintain.

1. Install one Release build

Follow the bare React Native installation guide before building. Use a test channel such as develop, record the Android runtime version, and set the startup policy to on-next-launch. Review any changes to Metro and to the native code that selects the Release bundle.

Before building, add a test-only readout for the running bundle’s source and dist from getObservabilityContext(), plus useBundleDrop().pendingApply. Install the Release binary and confirm the baseline label, Preview. Run the test with Metro stopped.

2. Change one line of JavaScript

In the source revision used for the installed build, change Preview to Preview OTA. Keep the native project, dependencies, and runtime version fixed. From the app directory, upload to the same channel. Substitute the native app version on your test device for 1.2.3.

npx bundle-drop upload android --version 1.2.3 --channel develop
Enter fullscreen mode Exit fullscreen mode

Save the update hash from the upload summary. If you use managed publishing, make the test installation eligible for that rollout. The upload records the release. Platform, channel, runtime, and rollout settings determine whether the device is offered it.

3. Check what the device is running

Fully close and reopen the same Release app. Wait for pendingApply to become true. With on-next-launch, the new bundle is staged and the old label stays visible. Cold launch again and check for Preview OTA.

On that second launch, read the active bundle from your test screen or a test-only handler:

import { getObservabilityContext } from "@gfean/react-native-bundle-drop";

const { source, dist } = await getObservabilityContext();
// source should be "ota" and dist should match the upload hash.
Enter fullscreen mode Exit fullscreen mode

An embedded bundle reports source: "embedded". Comparing dist to the upload hash distinguishes two updates that happen to contain the same UI change. If the update never arrives, start with the Release build, the channel and runtime match, and rollout eligibility.

The test is complete when the original installed binary runs the expected hash and shows the new label. If the next change adds a native module or needs a permission the installed binary lacks, ship a new native build through the store first.

Originally published on Bundle Drop Resources. This adaptation of the original guide was edited with AI assistance.

Top comments (1)

Collapse
 
userxnom profile image
Abdullah Naseer •

The discipline in this guide is the part worth copying: change exactly one line of JavaScript and keep the native project, dependencies, and runtime version fixed. Most first OTA tests change three things at once and then can't say what proved what. The "Preview" → "Preview OTA" label change is the smallest possible observable, and that's the point.

The detail I'd underline for anyone following along is comparing dist to the upload hash instead of trusting the label alone. Two updates can contain the same UI change, and a label check would call both of them correct — the hash is the only thing that proves the device is running the update you think it is. Same logic as the embedded bundle reporting source: "embedded": the readout has to distinguish the cases that look identical on screen.

One question: with on-next-launch and Metro stopped, what happens on that first reopen if the staged bundle is bad — does the client fall back to the embedded bundle, or does the app stay on the staged one and keep showing the old label? I'm curious where the rollback lives in this setup, since a failed first update is exactly when you'd want the fallback to be automatic, not something you discover in production.