https://github.com/qnrjs42/react-native-nitro-restart
🔥 Insanely fast native C++, Swift or Kotlin modules with a statically compiled binding layer to JSI - restart, exit app
https://github.com/qnrjs42/react-native-nitro-restart
exit nitro nitro-modules react-native restart
Last synced: about 7 hours ago
JSON representation
🔥 Insanely fast native C++, Swift or Kotlin modules with a statically compiled binding layer to JSI - restart, exit app
- Host: GitHub
- URL: https://github.com/qnrjs42/react-native-nitro-restart
- Owner: qnrjs42
- Created: 2025-10-01T07:57:41.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2025-10-01T08:58:23.000Z (9 months ago)
- Last Synced: 2025-10-29T04:23:25.420Z (8 months ago)
- Topics: exit, nitro, nitro-modules, react-native, restart
- Language: C++
- Homepage: https://www.npmjs.com/package/@qnrjs42/react-native-nitro-restart
- Size: 89.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-native-nitro-restart
Restart or exit your React Native app programmatically. Built with [Nitro Modules](https://github.com/mrousavy/nitro).
## Installation
```bash
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:
```bash
cd ios && pod install
```
## Usage
```typescript
import { restartApp, exitApp } from '@qnrjs42/react-native-nitro-restart';
// Restart the app
restartApp();
// Exit the app
exitApp();
```
That's it.
## API
### `restartApp()`
Restarts your React Native app.
- iOS: Uses React Native's built-in reload mechanism
- Android: Relaunches the main activity with a fresh task
### `exitApp()`
Exits the application.
- iOS: Suspends and exits after 0.5s
- Android: Kills the process cleanly
## Examples
### Restart after language change
```typescript
import { restartApp } from '@qnrjs42/react-native-nitro-restart';
import AsyncStorage from '@react-native-async-storage/async-storage';
const changeLanguage = async (lang: string): Promise => {
await AsyncStorage.setItem('language', lang);
restartApp();
};
```
### Exit on logout
```typescript
import { exitApp } from '@qnrjs42/react-native-nitro-restart';
const logout = async (): Promise => {
await clearUserData();
exitApp();
};
```
## Requirements
- React Native >= 0.70
- iOS >= 13.0
- Android >= 21
- react-native-nitro-modules (peer dependency)
## Why Nitro?
Nitro provides direct native calls without the React Native bridge, making this library fast and type-safe with zero overhead.
## License
MIT