@korsolutions/react-native-joystick
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

React Native Joystick

NPM

runs with Expo Go

TOC

Installation

NPM

npm install react-native-joystick react-native-gesture-handler --save

YARN

yarn add react-native-joystick react-native-gesture-handler

Add GestureHandlerRootView at the root level of your app.

import { GestureHandlerRootView } from "react-native-gesture-handler";

<GestureHandlerRootView>
  <YourApp />
</GestureHandlerRootView>

Preview

React Native Axis Pad: Screen Preview

Usage

import { KorolJoystick } from "korol-joystick";
<KorolJoystick color="#06b6d4" radius={75} onMove={(data) => console.log(data)} />

Props

radius

Set the size radius of the container circle The inside joystick radius is 1/3 of this size Type: Number

color

Set the color scheme of the joystick The color of the container and the joystick is set based on this color with a set opacity.

type: HEX Color Code

onMove, onStart, onStop

A callback function with an argument of type MoveJoystickEvent.

type: Function

Types

MoveJoystickEvent

Event returned by the onMove, onStart and onStop callbacks.

{
  type: "move" | "stop" | "start";
  position: {
    x: number;
    y: number;
  }
  force: number;
  angle: {
    radian: number;
    degree: number;
  }
}

Package Sidebar

Install

npm i @korsolutions/react-native-joystick

Weekly Downloads

19

Version

2.0.1

License

MIT

Unpacked Size

14.2 kB

Total Files

11

Last publish

Collaborators

  • ionkorol03