Skip to content

Feature request: pass event object #1

@ghost

Description

Hi,

Nice project, but I found something while using it that could be optimized.
In your code you can pass the event object like this:

onKeyDown: (e) => {
    if (e.keyCode === 37){
      if(ArrowKeysReact._config.hasOwnProperty('left')){
        ArrowKeysReact._config.left(e);
      }
    }
    ...

This way, a user can accept this as a parameter in his config and use it if and when necessary like this:

ArrowKeysReact.config({
      left: (e) => {
        e.preventDefault();
       ...other stuff
      },

If you want I can make a pull request for you to review.

Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions