Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@shankarmorwal/usebackbuttonhook

habilelabs5ISC1.0.0

Use back button hook for react native

react, native, use, back, buttton, control, back, button

readme

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.