@shankarmorwal/react-native-exit-on-double-press

1.0.2 • Public • Published

react-native-exit-on-double-press

Custom hook that can be used to exit the app on double press. It uses small toaster inside. This will work only on android.

Usage

import {useExitAppOnDoublePress} from "@shankarmorwal/react-native-exit-on-double-press";

then use it like this

useExitAppOnDoublePress({
        condition: true;
        message: "Press Again To Exit";
        timeout: 2000;
     });

This hook currently uses this options.

Condition: By default this is set to true. you can pass some custom condition. When this is false then this hook will not work.

message: It is custom message on first exit press

timeout: It is by default set to 2000 milli seconds. It will the duration between two double press to exit the app.

Package Sidebar

Install

npm i @shankarmorwal/react-native-exit-on-double-press

Weekly Downloads

4

Version

1.0.2

License

ISC

Unpacked Size

3.27 kB

Total Files

3

Last publish

Collaborators

  • shankarmorwal