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

@fallingllama/react-native-hsv-color-picker

v1.0.2

Published

a react native HSV(hue, saturation, value) color picker

Downloads

3

Readme

ℹ️ Forked from https://github.com/yuanfux/react-native-hsv-color-picker.git

react-native-hsv-color-picker

a react native HSV(hue, saturation, value) color picker

npm GitHub issues NPM

Preview

View Live Demo

react-native-hsv-color-picker is a React Native component for building an HSV (hue, saturation, value) color picker.

Highlighted Features:

  1. Real Rendering - no image involved / all colors are truly rendered
  2. Performance - empowered by native gradient lib
  3. Fully Controlled - no inner state involved
  4. Fully Supported - support both React Native & Expo projects

Install

$ npm install react-native-hsv-color-picker --save

Use with Expo Project

You are all set.

Use with React Native Project

react-native-hsv-color-picker is powered by the lib expo-linear-gradient. Besides above command, you have to follow this Instruction to add relevant dependencies to your project.

Usage

a minimally-configured HSV color picker

import React from 'react';
import { StyleSheet, View } from 'react-native';
import HsvColorPicker from 'react-native-hsv-color-picker';

export default class Example extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      hue: 0,
      sat: 0,
      val: 1,
    };
    this.onSatValPickerChange = this.onSatValPickerChange.bind(this);
    this.onHuePickerChange = this.onHuePickerChange.bind(this);
  }

  onSatValPickerChange({ saturation, value }) {
    this.setState({
      sat: saturation,
      val: value,
    });
  }

  onHuePickerChange({ hue }) {
    this.setState({
      hue,
    });
  }

  render() {
    const { hue, sat, val } = this.state;
    return (
      <View style={styles.container}>
        <HsvColorPicker
          huePickerHue={hue}
          onHuePickerDragMove={this.onHuePickerChange}
          onHuePickerPress={this.onHuePickerChange}
          satValPickerHue={hue}
          satValPickerSaturation={sat}
          satValPickerValue={val}
          onSatValPickerDragMove={this.onSatValPickerChange}
          onSatValPickerPress={this.onSatValPickerChange}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Props

Basic Props

| Prop | Type | Default | Description | |--|--|--| -- | | containerStyle | ViewPropTypes.style | {} | style for the outmost container | | huePickerContainerStyle | ViewPropTypes.style | {} | style for the hue picker container | | huePickerBorderRadius | number | 0 | border radius for the hue picker | | huePickerHue | number | 0 | hue value(h in hsv, ranged in [0, 360]) for the hue picker | | huePickerBarWidth | number | 12 | bar width for the hue picker | | huePickerBarHeight | number | 200 | bar height for the hue picker | | huePickerSliderSize | number | 24 | slider diameter for the hue picker | | satValPickerContainerStyle | ViewPropTypes.style | {} | style for the saturation & value picker container | | satValPickerBorderRadius | number | 0 | border radius for the saturation & value picker | | satValPickerSize | number | 200 | width / height for the saturation & value picker | | satValPickerSliderSize | number | 24 | slider diameter for the saturation & value picker | | satValPickerHue | number | 0 | hue value(h in hsv, ranged in [0, 360]) for the saturation & value picker | | satValPickerSaturation | number | 1 | saturation value(s in hsv, ranged in [0, 1]) for the saturation & value picker | | satValPickerValue | number | 1 | value(v in hsv, ranged in [0, 1]) for the saturation & value picker |

Callback Props

| Prop | Callback Params | Description | |--|--| -- | | onHuePickerDragStart | {    hue: number,    gestureState: gestureState} | called when hue picker starts to drag | | onHuePickerDragMove | {    hue: number,    gestureState: gestureState} | called when hue picker is dragging | | onHuePickerDragEnd | {    hue: number,    gestureState: gestureState} | called when hue picker stops dragging | | onHuePickerDragTerminate | {    hue: number,    gestureState: gestureState} | called when another component has become the responder | | onHuePickerPress | {    hue: number,    nativeEvent: nativeEvent} | called when hue picker is pressed | | onSatValPickerDragStart | {    saturation: number,    value: number,    gestureState: gestureState} | called when saturation & value picker starts to drag | | onSatValPickerDragMove | {    saturation: number,    value: number,    gestureState: gestureState} | called when saturation & value picker is dragging | | onSatValPickerDragEnd | {    saturation: number,    value: number,    gestureState: gestureState} | called when saturation & value picker stops dragging | | onSatValPickerDragTerminate | {    saturation: number,    value: number,    gestureState: gestureState} | called when another component has become the responder | | onSatValPickerPress | {    saturation: number,    value: number,    nativeEvent: nativeEvent} | called when saturation & value picker is pressed |

Methods

Instance Methods

Use ref to call instance methods

| Method | Params | Return Type| Description | |--|:--:|:--:| -- | | getCurrentColor | - | string | get current picked color in hex format |

Dev

The demo folder contains a standalone Expo project, which can be used for dev purpose.

react-native - 0.61 react - 16.9

  1. Start Expo

    $ npm install
    
    $ npm start
  2. Run on simulator

    • type the following command in the Terminal after the project is booted up
    • a for android simulator
    • i for iOS simulator
  3. Run on device

    • require the installation of corresponding iOS client or android client on the device
    • scan the QR code from Terminal using the device
  4. More on Expo Guide

Related

License

MIT