https://github.com/bamlab/react-navigation-live-reload-on-screen
https://github.com/bamlab/react-navigation-live-reload-on-screen
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/bamlab/react-navigation-live-reload-on-screen
- Owner: bamlab
- Created: 2021-08-05T13:43:28.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-03-21T09:49:11.000Z (over 1 year ago)
- Last Synced: 2025-05-23T22:42:47.661Z (about 1 year ago)
- Language: TypeScript
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-navigation-live-reload-on-screen
Based [on this](https://reactnavigation.org/docs/state-persistence), stay on current screen when you live reload.
This works by storing the navigation state in the async storage and getting it back when reloading.
## Install
```sh
yarn add @bam.tech/react-navigation-live-reload-on-screen
```
## Usage
```tsx
import { NavigationContainer as ReactNavigationContainer } from "@react-navigation/native";
import { enableLiveReloadOnScreen } from "@bam.tech/react-navigation-live-reload-on-screen";
const ENABLE_LIVE_RELOAD = __DEV__;
const ENABLE_LIVE_RELOAD_LOGS = true;
const NavigationContainer = enableLiveReloadOnScreen(ENABLE_LIVE_RELOAD, ENABLE_LIVE_RELOAD_LOGS)(
ReactNavigationContainer
);
// Use NavigationContainer instead of the one from react-navigation
```
### Clearing navigation state
If you need to clear the persisted navigation state at some point:
```tsx
import { clearNavigationState } from "@bam.tech/react-navigation-live-reload-on-screen";
clearNavigationState();
```