React Native SDK for Patchkite, self-hosted over-the-air updates.
- New Architecture (TurboModule, bridgeless), iOS and Android, React Native 0.80+
- Diff updates and binary patches, so small changes are small downloads
- Automatic rollback when an update crashes before
notifyAppReady() - Code signing: packages are verified against your public key
- CodePush-style API:
sync,checkForUpdate, install modes, update dialog
npm install @patchkite/react-native
cd ios && pod installAndroid — load the bundle through Patchkite in MainApplication.kt:
import io.github.patchkite.reactnative.Patchkite
override val reactHost: ReactHost by lazy {
getDefaultReactHost(
context = applicationContext,
packageList = PackageList(this).packages,
jsBundleFilePath = Patchkite.getJSBundleFile(applicationContext),
)
}and configure it in res/values/strings.xml:
<string moduleConfig="true" name="PatchkiteServerUrl">https://patchkite.example.com</string>
<string moduleConfig="true" name="PatchkiteDeploymentKey">DEPLOYMENT_KEY</string>iOS — in AppDelegate.swift:
import PatchkiteReactNative
override func bundleURL() -> URL? {
#if DEBUG
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
Patchkite.bundleURL()
#endif
}and add PatchkiteServerURL and PatchkiteDeploymentKey to Info.plist.
JavaScript — wrap your root component:
import patchkite from "@patchkite/react-native";
export default patchkite({ checkFrequency: patchkite.CheckFrequency.ON_APP_RESUME })(App);Release updates with the Patchkite CLI:
patchkite release-react MyApp-Android androidThe React Native guide covers deployment keys per build, code signing, manual control, and verification. See the API reference for every function and option.
| Path | Description |
|---|---|
src/ |
TypeScript API |
android/, ios/ |
Native module (Kotlin, Swift/Objective-C++) |
ios-tests/ |
Swift package that unit-tests the iOS core on macOS |
test/fixtures/ |
Reference values from the server (package hash, signatures, zips, bsdiff) |
example/ |
Example app that links the SDK from this folder |
npm install && npm run typecheck
(cd ios-tests && swift test)
(cd example && npm install && cd android && ./gradlew :patchkite_react-native:testDebugUnitTest)