Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
arrow-keys-react
Advanced tools
Readme
Easily integrate your react component with keyboard arrow keys, with the same configuration used in swipe-react and wheel-react packages.
npm install --save arrow-keys-react
import ArrowKeysReact from 'arrow-keys-react';
ArrowKeysReact.config({
left: () => {
console.log('left key detected.');
},
right: () => {
console.log('right key detected.');
},
up: () => {
console.log('up key detected.');
},
down: () => {
console.log('down key detected.');
}
});
<YourComponent {...ArrowKeysReact.events} />
import React, { Component } from 'react';
import ArrowKeysReact from 'arrow-keys-react';
class App extends Component {
constructor(props){
super(props);
this.state = {
content: 'Use arrow keys on your keyboard!'
};
ArrowKeysReact.config({
left: () => {
this.setState({
content: 'left key detected.'
});
},
right: () => {
this.setState({
content: 'right key detected.'
});
},
up: () => {
this.setState({
content: 'up key detected.'
});
},
down: () => {
this.setState({
content: 'down key detected.'
});
}
});
}
render() {
return (
<div {...ArrowKeysReact.events} tabIndex="1">
{this.state.content}
</div>
);
}
}
export default App;
div
, add tabIndex
property.tab
key in the keyboard. Alterntively you can program your component to focus()
when it loaded.ArrowKeysReact.config
can be placed in render
function instead of in the constuctor
function.FAQs
Easily integrate your react component with keyboard arrow keys, with the same configuration used in swipe-react and wheel-react packages.
The npm package arrow-keys-react receives a total of 1,513 weekly downloads. As such, arrow-keys-react popularity was classified as popular.
We found that arrow-keys-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.