# react-joystick

> A React component for joystick

Latest version **1.0.3** (published 2018-04-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-joystick
pnpm add react-joystick
yarn add react-joystick
bun add react-joystick
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-04-16 |
| First published | 2018-03-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 27.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Yanda Huang |
| Maintainers | yodahuang |
| Keywords | joystick |

## Links

- npm: https://www.npmjs.com/package/react-joystick
- Repository: https://github.com/yodahuang/react_joystick
- Homepage: https://github.com/yodahuang/react_joystick#readme
- Issues: https://github.com/yodahuang/react_joystick/issues
- npm.io page: https://npm.io/package/react-joystick

## Dependencies (9)

- [react](https://npm.io/package/react.md) ^16.3.1
- [webpack](https://npm.io/package/webpack.md) ^4.2.0
- [nipplejs](https://npm.io/package/nipplejs.md) ^0.6.8
- [react-dom](https://npm.io/package/react-dom.md) ^16.3.1
- [css-loader](https://npm.io/package/css-loader.md) ^0.28.11
- [prop-types](https://npm.io/package/prop-types.md) ^15.6.1
- [file-loader](https://npm.io/package/file-loader.md) ^1.1.11
- [style-loader](https://npm.io/package/style-loader.md) ^0.20.3
- [react-scripts](https://npm.io/package/react-scripts.md) ^1.1.4

## Recent versions

- 1.0.3 (latest) — 2018-04-16
- 1.0.2 — 2018-04-16
- 1.0.1 — 2018-04-15
- 1.0.0 — 2018-04-15
- 2.0.0 — 2018-04-15
- 0.2.0 — 2018-03-25
- 0.1.1 — 2018-03-25
- 0.1.0 — 2018-03-25

## README

## React Joystick

[![NPM](https://nodei.co/npm/react-joystick.png)](https://nodei.co/npm/react-joystick/)
[![Build Status](https://travis-ci.org/yodahuang/react_joystick.svg?branch=master)](https://travis-ci.org/yodahuang/react_joystick)

This is a React components for rendering a joystick. It's a wrapper for [nipple.js](https://yoannmoinet.github.io/nipplejs/)

### Properties

- `options`: Options for creating `nipplejs` joysticks
- `containerStyle`: the style for the `div` component containing joystick
- `managerListener`: the function callback that will have `manager` as a parameter so that you can control the behaviour of joystick

### Example

```javascript
import Joystick from react-joystick

const joyOptions = {
    mode: 'semi',
    catchDistance: 150,
    color: 'white'
}

const containerStyle = {
    position: 'relative',
    height: '350px',
    width: '100%',
    background: 'linear-gradient(to right, #E684AE, #79CBCA, #77A1D3)'
}


class JoyWrapper extends Component {
    constructor() {
        super();
        this.managerListener = this.managerListener.bind(this);
    }

    managerListener(manager) {
        manager.on('move', (e, stick) => {
            console.log('I moved!')
        })
        manager.on('end', () => {
            console.log('I ended!')
        })
    }

    render() {
        const { classes } = this.props;
        return (
            <div>
                <JoyStick joyOptions={joyOptions} containerStyle={containerStyle} managerListener={this.managerListener} />
            </div>
        )
    }
}

```

---
_Source: https://npm.io/package/react-joystick · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
