@logicwind/react-native-exit-app is a simple React Native library that allows you to programmatically exit or close your app. It's useful for scenarios where you want to force the app to close, such as after a logout, session timeout, or a critical error. The library supports both Android and iOS as well as TvOS.
Using npm:
npm install @logicwind/react-native-exit-appor using yarn:
yarn add @logicwind/react-native-exit-appIf you're working with this Expo project, make sure to run:
npx expo prebuildAfter installation, make sure to install CocoaPods:
cd ios && pod installNo additional setup is required.
Import and use the exitApp function.
import { exitApp } from '@logicwind/react-native-exit-app';
<Button title="Exit App" onPress={() => exitApp()} />;@logicwind/react-native-exit-app uses native code to exit the app based on the platform:
- iOS: The module uses exit(0) to force the app to close.
- Android: The module calls System.exit(0) or finishes the activity to terminate the app.
react-native-exit-app is crafted mindfully at Logicwind
We are a 130+ people company developing and designing multiplatform applications using the Lean & Agile methodology. To get more information on the solutions that would suit your needs, feel free to get in touch by email or through or contact form!
We will always answer you with pleasure 😁
This project is licensed under the MIT License - see the LICENSE file for details