API Reference
This section contains the API Reference provided by Stallion SDK
JS APIs
Method | Description | Example |
---|---|---|
withStallion | HOC method for Stallion wrapped app | withStallion(App) |
useStallionModal | React hook to control Stallion modal | const { showModal } = useStallionModal(); , then call showModal from anywhere |
useStallionUpdate | React hook to get status of a production release | const { isRestartRequired, currentlyRunningBundle, newReleaseBundle } = useStallionUpdate(); . isRestartRequired is a boolean which tells if a new release is available and app needs to be restarted to install the release. currentlyRunningBundle , newReleaseBundle are objects containing meta information about a Stallion Release like isMandatory, release notes, version etc. |
addEventListener | Function to listen to SDK events related to a Stallion release | Stallion.addEventListener(callback) . Callback will return an event object with a type and payload . Events can be DOWNLOAD_STARTED , DOWNLOAD_COMPLETE , UPDATE_INSTALLED , AUTO_ROLLBACK etc |
sync | Function to manually trigger Stallion workflow to check for a new available release and download it in memory | Stallion.sync() . Trigger this method from anywhere in your app code to manually trigger a check workflow. Useful if you want to have a custom download strategy. By default Stallion.sync() is automatically fired everytime app is restarted or resumed. |
Android APIs
Method | Description | Example |
---|---|---|
getJSBundleFile | Function to receive the JS bundle URL for your RN app. It expects 2 arguments. 2nd argument is optional - getJSBundleFile(<your-application-context>, <default bundle URL value>) | Stallion.getJSBundleFile(getApplicationContext(), "assets://index.android.bundle") |
iOS APIs
Method | Description | Example |
---|---|---|
getBundleURL | Function to receive the JS bundle URL for your RN app. It expects 1 optional parameter - [StallionModule getBundleURL:<your-default-bundle-url-value> | [StallionModule getBundleURL:[[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]] |