@apptile/tile-push-react-native
v0.1.0
Published
Tile Push React Native SDK — multi-tenant OTA updates for React Native apps.
Readme
@tile-push/react-native
Multi-tenant React Native OTA updates, powered by Tile Push.
Install
npm install @tile-push/react-native @hot-updater/react-native
# or
yarn add @tile-push/react-native @hot-updater/react-native
@hot-updater/react-nativeis a peer dependency — install it alongside.
Usage
import { TilePush } from '@tile-push/react-native';
function App() {
return <YourAppRoot />;
}
export default TilePush.wrap({
appId: 'tk_yourapp-prod', // your Tile Push tenant id
apiUrl: 'https://api.your-tile-push-deployment.com', // from your dashboard
updateStrategy: 'fingerprint', // or 'appVersion'
})(App);
apiUrlis required — there is no shared default. Get yours from the Tile Push dashboard. Hardcoding a single global default would route every install through one origin, so the SDK forces you to be explicit.
That's the entire integration. Tile Push handles:
- Multi-tenant URL routing (
/api/check-update/v2/t/{appId}/...) - Cohort-based rollout picking on the client
- Update download + apply via the underlying SDK
- Sub-150ms latency from edge POPs (Firebase Hosting CDN)
Configuration
TilePush.wrap({
// Required
appId: 'tk_yourapp-prod',
apiUrl: 'https://api.your-tile-push-deployment.com',
updateStrategy: 'fingerprint',
// Pass through any standard HotUpdater wrap option
fallbackComponent: MyFallback,
reloadOnForceUpdate: true,
requestHeaders: { 'x-client': 'myapp' },
requestTimeout: 5000,
onError: (err) => console.error('[Tile]', err),
onProgress: (progress) => console.log(`download ${progress * 100}%`),
onNotifyAppReady: (result) => console.log('app ready', result),
})(App);Alternative: Manual init
import { TilePush } from '@tile-push/react-native';
// In your app entry, before any check is needed:
TilePush.init({
appId: 'tk_yourapp-prod',
apiUrl: 'https://api.your-tile-push-deployment.com',
updateStrategy: 'fingerprint',
});
// Later, anywhere:
const result = await TilePush.checkForUpdate({
updateStrategy: 'fingerprint',
});
if (result) await result.updateBundle();Cohort targeting
Tile Push handles cohort picking transparently. Each device gets a stable cohort value (1–1000) on first launch, persisted natively. When a bundle is rolled out to a subset of cohorts, only devices in that set receive it. You don't have to do anything — the SDK picks the right candidate from the server's response.
For testing, you can override the device cohort:
import { TilePush } from '@tile-push/react-native';
TilePush.setCohort('500'); // numeric cohort
TilePush.setCohort('beta-team'); // custom slug for explicit targeting
console.log(TilePush.getCohort());What's under the hood
This package is a thin wrapper around
@hot-updater/react-native
(MIT). The wrapper:
- Provides a tenant-aware URL builder so customers don't have to construct
/api/check-update/v2/t/{appId}/...themselves. - Adds client-side cohort picking against the v2 candidates response.
- Re-exports upstream APIs with Tile Push branding so customers only import
from
@tile-push/react-native.
The native bridge, downloader, applier, store, and SDK hooks are upstream — this package owns only the multi-tenant routing layer.
License
MIT. See LICENSE for full text including required upstream
attribution to the @hot-updater/react-native authors.
