Initialize Bundle Drop once, then choose the level of control your app needs:
- BundleDrop.init for startup configuration and policy-driven behavior
- useBundleDrop for manual, UI-driven update workflows
- Runtime APIs for lower-level direct control
Runtime APIs
checkForUpdate(...): checks whether an update, rollback, or no-op decision is availabledownloadUpdate(...): downloads and stages an updateapplyUpdate(...): applies a staged update and reloads the appgetUpdateState(): returns whether a bundle exists locally and whether one is pending applygetAvailableChannels(): fetches public channel namesBundleDrop.setChannel(...): switches the active runtime channelsetUserProperty(...)andremoveUserProperty(...): manage user properties for targeted rolloutgetObservabilityContext(): returns the running bundle'sdist(hash), channel, and tags for error tracking — see Observability
The detailed function behavior and return shapes are covered on Runtime APIs.
Choosing Between Them
Start with BundleDrop.init in every app.
Use useBundleDrop if you want to build your own update UI and let users trigger actions manually.
If you want startup automation, choose a non-manual policy in BundleDrop.init. The policy behavior is covered in Update Policies.
Typical Usage
import { BundleDrop } from "@gfean/react-native-bundle-drop";
BundleDrop.init({
enabled: !__DEV__,
environment: __DEV__ ? "development" : "production",
channelName: "develop",
policy: __DEV__ ? "manual" : "on-next-launch",
});Call the hook inside a React component, after initialization. For example, expose an explicit apply action when an update or rollback is staged:
import { Alert, Button, Text, View } from "react-native";
import { useBundleDrop } from "@gfean/react-native-bundle-drop";
export function UpdatesScreen() {
const { status, isBusy, pendingApply, applyUpdate } = useBundleDrop();
async function applyPendingUpdate() {
try {
await applyUpdate();
} catch (error) {
Alert.alert("Update unavailable", String(error));
}
}
return (
<View>
<Text>{status}</Text>
<Button
title="Apply pending update"
disabled={isBusy || !pendingApply}
onPress={applyPendingUpdate}
/>
</View>
);
}Automatic application follows the configured policy. For a complete custom UI with download and channel controls, see useBundleDrop.
Related Docs
- For automatic compatibility with optional explicit runtime boundaries, see Native Fingerprinting.
- For lower-level runtime functions, see Runtime APIs.
- For runtime startup setup, see BundleDrop.init.
- For manual UI-driven flows, see useBundleDrop.
- For policy behavior, see Update Policies.
- For error tracking and source maps, see Observability.