setReloadBehavior
Since 0.27.0+Control how HotUpdater.reload() is executed.
Usage
Use HotUpdater.setReloadBehavior() to control how HotUpdater.reload() is applied.
The default is processRestart.
This is a global setting, so calling it once during app startup is enough.
reloadandprocessRestartare Android-focused built-in behaviors- On iOS, both built-in behaviors behave like the normal React Native reload flow
customworks on both Android and iOS
import { HotUpdater } from "@hot-updater/react-native";
HotUpdater.setReloadBehavior("processRestart");Why this exists
Android's normal React Native reload is an in-process reload. The current React instance goes down, a new one comes up, and native modules can still touch JS in the middle of that handoff.
We reproduced a real Android release failure pattern where a third-party native module or background callback kept emitting to JS while React was being recreated.
That can show up as errors like ReactNoCrashSoftException, reactInstance is null, or Tried to access a JS module before the React instance was fully set up.
Depending on timing, the result can be a soft exception, blank screen, or full app crash.
processRestart avoids that class of problem by restarting the app cold instead of recreating only the current React Native runtime.
Supported behaviors
processRestart (default)
- Android only
- Restarts the app cold and starts again from the splash screen
- Best default for standalone Android apps
HotUpdater.setReloadBehavior("processRestart");reload
- Android only
- Uses the normal in-process React Native reload
- Reloads the current React Native screen/runtime instead of restarting the whole app
HotUpdater.setReloadBehavior("reload");custom
- Android and iOS
- Runs your own reload logic
- Best when a brownfield host app must reopen a specific native container or screen itself
HotUpdater.setReloadBehavior("custom", async () => {
await BrownfieldModule.reload();
});When to use which
- Use
processRestartif you want the safest Android default - Use
reloadin brownfield apps when only the current React Native area should refresh - Use
customin brownfield apps when the host app must coordinate navigation or container restore itself