Skip to content

Suggesting a new feature "onBackPress" #183

Description

@viktoriasiigur

Is there a possibility that feature "onBackPress" will be added to the library?

The idea is to have a similar functionality to onEnterPress or onArrowPress. Using the library for the TV application, there are a lot of cases where it is necessary to add different callbacks on pressing the back button on a remote control. A simple callback added to the useFocusable hook would make the code prettier and easily readable. Currently I must use listeners for handling those cases.

Example:

const { ref } = useFocusable({
    onEnterRelease: onEnter,
    onArrowPress: (direction) => {
        console.log(direction);
    },
    // requested function
    onBackPress: () => { 
       console.log("back button pressed");
    }
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions