Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a ShortcutsProvider #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add a ShortcutsProvider #48

wants to merge 1 commit into from

Conversation

greena13
Copy link

The current installation instructions require the user to manually add a shortcut manager instance to the shortcuts attribute of their react application's context.

This is extra work for users of the library that React Shortcuts can do automatically (as is done in popular libraries like react-router and react-redux).

This pull request adds a ShortcutsProvider component that can be used to wrap a React application and provides a cleaner, easier-to-use API for users of React Shortcuts. It removes an installation step and reduces the chance the library will be set up incorrectly.

It can be used like so:

import keymap from './keymap'
import { ShortcutsProvider } from 'react-shortcuts'

// ...

<ShortcutsProvider keymap={ keymap } >
   <MyApplication >

   </MyApplication>
</ShortcutsProvider>

@petrbrzek
Copy link
Member

@greena13 Thank you for your amazing work. I'll get to those PRs in a few days (I'm just traveling).

@greena13
Copy link
Author

No problem, @petrbrzek. Thanks for letting me know to expect a delay.

I have a few more suggestions that I will draft up as pull requests, that you can look over when it is next convenient for you to do so. Safe travels.

@kumarharsh
Copy link

kumarharsh commented May 8, 2018

+1 would love to see these changes merged into a release.

Talking about release - the latest release was 1.6.2, but the package.json in master has a v2.0.0 version which was never published to npm. I also see that the current build is failing in Travis with yarn related warnings.

This library is the closest to what I was imagining a good react keybinding lib should be. I was going to write a new one using mousetrap, and found this library by following a bunch of issues from mousetrap. I see that development has apparently stalled since mid-October. @petrbrzek is there a plan to maintain this library? I have some time on my hands currently and would like to contribute here if possible.

@qpre
Copy link

qpre commented Jul 30, 2018

As the legacy context API is being removed from React this PR is gaining traction.

@petrbrzek is there any plan on your side on moving forward with project ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants