React Native API
isChannelSwitched
The `hotUpdater.isChannelSwitched()` function returns whether a runtime channel switch is currently active.
Usage
Use hotUpdater.isChannelSwitched() to determine whether the selected channel
differs from the build-time default. It can become true after staging, before
the app reloads into the selected code.
import { hotUpdater } from "./hotUpdater";
if (hotUpdater.isChannelSwitched()) {
console.log("Using a runtime channel switch");
}Return value
Returns true when:
- A transition to another channel was successfully staged
- The runtime channel switch has not been cleared with
hotUpdater.resetChannel()
Returns false when:
- The app is still on its build-time default channel
hotUpdater.resetChannel()has already cleared the runtime channel switch
Example
After initializing Hot Updater, check for a
staging update. This example assumes the build-time default channel is
production.
import { hotUpdater } from "./hotUpdater";
const updateInfo = await hotUpdater.checkForUpdate({
updateStrategy: "appVersion",
channel: "staging",
});
if (updateInfo) {
const didUpdate = await updateInfo.updateBundle();
if (didUpdate) {
console.log(hotUpdater.isChannelSwitched()); // true
await hotUpdater.reload();
}
}