npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-lucky-wheel

v0.2.2

Published

Lucky Wheel for React Native.

Downloads

55

Readme

react-native-lucky-wheel

npm version CircleCI Commitizen friendly license

A decent lucky wheel component for React-Native

It's sucks that writing a lucky wheel (known as wheel of fortune) component. I wrote one, so you wouldn't have to.

Table of Contents

Getting started

:warning: it's not tested on field.

yarn add react-native-lucky-wheel

Dependencies

This library needs these dependencies to be installed in your project before you can use it:

For Expo CLI:

expo install react-native-svg

For React Native CLI

yarn add react-native-svg

Check react-native-svg installation guide.

API

The <LuckyWheel> component can take a number of inputs to customize it as needed. They are outlined below:

Props

| Name | Type | Required | Default Value | | :--------------------- | :---------------------------------------- | :------: | :---------------------------------: | | slices | ISlice[] | + | - | | padAngle | number | - | 0.01 | | outerRadius | number | - | 13 | | innerRadius | number | - | 30 | | duration | number | - | 4 | | enableGesture | boolean | - | false | | enablePhysics | boolean | - | false | | enableOuterDots | boolean | - | true | | gestureType | GestureType | - | GestureTypes.CLOCKWISE | | size | number | - | width - 40 | | winnerIndex | number | - | - | | minimumSpinVelocity | number | - | 1 | | textStyle | ITextStyle | - | - | | textAngle | TextAngleType | - | TextAngles.VERTICAL | | backgroundColorOptions | RandomColorOptionsSingle | - | {luminosity: 'dark', hue: 'random'} | | offset | number | - | 0 | | backgroundColor | Color | - | #FFF | | knobSize | number | - | 30 | | knobColor | Color | - | #FF0000 | | easing | EasingType | - | EasingTypes.OUT | | dotColor | Color | - | #000 | | onKnobTick | () => void | - | - | | onSpinningStart | () => void | - | - | | onSpinningEnd | (winner: ISlice) => void | - | - | | source | ImageSourcePropType | - | - | | customKnob | (params: ICustomKnob) => React.ReactChild | - | - | | customText | (params: IWheelText) => React.ReactChild | - | - | | waitWinner | boolean | - | false | | enableInnerShadow | boolean | - | true |

Methods

These are the various methods.

| Method | Params | Description | | :----- | :----: | :-------------- | | start | - | Start spinning. | | stop | - | Stop spinning. | | reset | - | Reset spinning. |

Usage

import LuckyWheel from 'react-native-lucky-wheel';

const SLICES = [
  { text: 'foo' },
  { text: 'bar' },
  { text: 'baz' },
  { text: 'qux' },
];

const App = () => {
  return <LuckyWheel slices={SLICES} />;
};

Advance Styling

I added some props to styling the wheel:

@TODO

Spin Types: Gesture and Method

You can spin the wheel with two different method:

@TODO

Wheel Types: SVG and Image

There are two different method to create a Lucky Wheel:

@TODO

Endless Spinning

If you want to select a winner after spinning begin you can use endless spinning feature of this library.

@TODO

Play Tick Sound

There are some libraries to play sound, I don't want to select one, so I decide to not add this feature. However, you can add this feature by yourself following below instructions:

@TODO

Example App

# clone the project
git clone https://github.com/ridvanaltun/react-native-lucky-wheel.git

# go into the project
cd react-native-lucky-wheel

# make project ready
npm run bootstrap

# go into the example
cd example

# run for android
npm run android

# or

# run for ios
npm run ios

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT