@shankarmorwal/usebackbuttonhook

1.0.0 • Public • Published

UseBackButtonHook

Handle back button on react native.

Usage

import {useBackButton} from "@shankarmorwal/usebackbuttonhook";

Now use it as

useBackButton(()=>{
        if(something){
            //do something.
            //when return true then it does not back. 
            return true;
        }
        else {
            //nothing to do in this mode.
            //default back will work now. 
            return false;
        }
    });

Rememeber this is custom hook so it can not be used inside any condition.

Package Sidebar

Install

npm i @shankarmorwal/usebackbuttonhook

Weekly Downloads

3

Version

1.0.0

License

ISC

Unpacked Size

1.82 kB

Total Files

3

Last publish

Collaborators

  • shankarmorwal