Javascript update API

Quick reference for the `useStallionUpdate` hook.

useStallionUpdate

import { useStallionUpdate } from "react-native-stallion";

const { isRestartRequired, currentlyRunningBundle, newReleaseBundle } =
  useStallionUpdate();
PropertyTypeWhat it tells you
isRestartRequiredbooleantrue when a newer bundle has finished downloading and the app must restart to install it.
currentlyRunningBundleIUpdateMeta | undefinedMetadata for the bundle that’s already running (version, release notes, isMandatory, etc.).
newReleaseBundleIUpdateMeta | undefinedMetadata for the downloaded bundle waiting to be applied. undefined until an update is available.

Minimal usage

import React from "react";
import { Modal, Text, Button } from "react-native";
import { useStallionUpdate, restart } from "react-native-stallion";

const UpdatePrompt = () => {
  const { isRestartRequired, newReleaseBundle } = useStallionUpdate();

  if (!isRestartRequired) return null;

  return (
    <Modal transparent>
      <Text>{newReleaseBundle?.releaseNote ?? "A new update is ready!"}</Text>
      <Button title="Restart now" onPress={restart} />
    </Modal>
  );
};

That’s all you need—the hook re‑renders automatically when an update arrives. Keep your prompt simple, clear, and fast to act. 👉 Want to see this in action? Dive into our guide Custom Update UX with Stallion


IUpdateMeta Field reference

PropertyTypeDescription
versionnumberIncrementing version or build number of the bundle.
authorstringUsername or identifier of the person who uploaded the release.
bucketIdstringInternal storage bucket ID where the bundle is stored.
sha256ChecksumstringSHA-256 checksum of the zipped bundle.
releaseNotestringHuman-readable notes describing what’s in this release.
sizenumberBundle size in bytes.
platformstringTarget platform (e.g., "ios", "android").
isCIUploadedbooleantrue if the bundle was uploaded via CI pipeline.
isPromotedbooleantrue if this bundle has been promoted to production.
createdAtstringISO-8601 timestamp when the bundle was created.
updatedAtstringISO-8601 timestamp of the last metadata update.
idstringUnique identifier for the bundle.
isMandatorybooleanIf true, the update is mandatory and restart cannot be skipped.