Skip to content

About

Patchkite SDK for React Native: over-the-air JavaScript updates. npm: @patchkite/react-native

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

@patchkite/react-native

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

Install

npm install @patchkite/react-native
cd ios && pod install

Setup

Android — 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 android

The React Native guide covers deployment keys per build, code signing, manual control, and verification. See the API reference for every function and option.

Development

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)

License

MIT

About

Patchkite SDK for React Native: over-the-air JavaScript updates. npm: @patchkite/react-native

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages