Restart or exit your React Native app programmatically. Built with Nitro Modules.
npm install @qnrjs42/react-native-nitro-restart # or yarn add @qnrjs42/react-native-nitro-restart # or pnpm add @qnrjs42/react-native-nitro-restart pnpm add -D react-native-nitro-modules
Then run pod install for iOS:
cd ios && pod install
import { restartApp, exitApp } from '@qnrjs42/react-native-nitro-restart'; // Restart the app restartApp(); // Exit the app exitApp();
That's it.
Restarts your React Native app.
- iOS: Uses React Native's built-in reload mechanism
- Android: Relaunches the main activity with a fresh task
Exits the application.
- iOS: Suspends and exits after 0.5s
- Android: Kills the process cleanly
import { restartApp } from '@qnrjs42/react-native-nitro-restart'; import AsyncStorage from '@react-native-async-storage/async-storage'; const changeLanguage = async (lang: string): Promise<void> => { await AsyncStorage.setItem('language', lang); restartApp(); };
import { exitApp } from '@qnrjs42/react-native-nitro-restart'; const logout = async (): Promise<void> => { await clearUserData(); exitApp(); };
- React Native >= 0.70
- iOS >= 13.0
- Android >= 21
- react-native-nitro-modules (peer dependency)
Nitro provides direct native calls without the React Native bridge, making this library fast and type-safe with zero overhead.
MIT