@apptile/tile-push-react-native
v0.2.1
Published
Tile Push React Native SDK — multi-tenant OTA updates for React Native apps.
Downloads
228
Readme
@apptile/tile-push-react-native
Multi-tenant React Native OTA updates, powered by Tile Push. This is the runtime
SDK — wrap your app and devices auto-update on launch. Ship updates with
@apptile/tile-push-cli.
Install
npm install @apptile/tile-push-react-native @hot-updater/react-native @hot-updater/core
# or
yarn add @apptile/tile-push-react-native @hot-updater/react-native @hot-updater/core
@hot-updater/react-nativeand@hot-updater/coreare peer dependencies — install them explicitly.
Usage
1. Wrap your root component
import { TilePush } from '@apptile/tile-push-react-native';
function App() {
return <YourAppRoot />;
}
export default TilePush.wrap({
appId: 'your-app-id', // your Tile Push tenant id
apiUrl: 'https://ota.tile.dev', // the OTA backend
updateStrategy: 'fingerprint', // or 'appVersion'
})(App);
apiUrlis required — there is no shared default (hardcoding one global origin would route every install through it). Usehttps://ota.tile.devfor the hosted Tile Push backend, or your own deployment.
2. Register the Expo config plugin
Add the package to app.json → expo.plugins. This is required for
updateStrategy: 'fingerprint' — it injects the native fingerprint hash at
expo prebuild so a device only accepts bundles built from a matching native tree:
{
"expo": {
"plugins": ["@apptile/tile-push-react-native"]
}
}That's the entire integration. Tile Push handles multi-tenant URL routing
(/api/check-update/v2/t/{appId}/...), client-side cohort rollout picking, and
update download + apply via the underlying SDK.
Configuration
TilePush.wrap({
// Required
appId: 'your-app-id',
apiUrl: 'https://ota.tile.dev',
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 '@apptile/tile-push-react-native';
TilePush.init({
appId: 'your-app-id',
apiUrl: 'https://ota.tile.dev',
updateStrategy: 'fingerprint',
});
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 — the SDK picks the right candidate from the server's response automatically.
For testing, override the device cohort:
import { TilePush } from '@apptile/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
A thin wrapper around
@hot-updater/react-native
(MIT). The wrapper adds a tenant-aware URL builder, client-side cohort picking
against the v2 candidates response, an Expo config plugin that injects the
fingerprint at build time, and re-exports upstream APIs under Tile Push branding
so you only import from @apptile/tile-push-react-native. The native bridge,
downloader, applier, store, and hooks are upstream.
License
MIT. See LICENSE for full text including required upstream attribution
to the @hot-updater/react-native authors.
