Javascript update API
Quick reference for the `useStallionUpdate` hook.
useStallionUpdate
import { useStallionUpdate } from "react-native-stallion";
const { isRestartRequired, currentlyRunningBundle, newReleaseBundle } =
useStallionUpdate();
Property | Type | What it tells you |
---|---|---|
isRestartRequired | boolean | true when a newer bundle has finished downloading and the app must restart to install it. |
currentlyRunningBundle | IUpdateMeta | undefined | Metadata for the bundle that’s already running (version, release notes, isMandatory , etc.). |
newReleaseBundle | IUpdateMeta | undefined | Metadata 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
Property | Type | Description |
---|---|---|
version | number | Incrementing version or build number of the bundle. |
author | string | Username or identifier of the person who uploaded the release. |
bucketId | string | Internal storage bucket ID where the bundle is stored. |
sha256Checksum | string | SHA-256 checksum of the zipped bundle. |
releaseNote | string | Human-readable notes describing what’s in this release. |
size | number | Bundle size in bytes. |
platform | string | Target platform (e.g., "ios" , "android" ). |
isCIUploaded | boolean | true if the bundle was uploaded via CI pipeline. |
isPromoted | boolean | true if this bundle has been promoted to production. |
createdAt | string | ISO-8601 timestamp when the bundle was created. |
updatedAt | string | ISO-8601 timestamp of the last metadata update. |
id | string | Unique identifier for the bundle. |
isMandatory | boolean | If true , the update is mandatory and restart cannot be skipped. |