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

@benjeau/react-native-draw-extras

v0.2.2

Published

Extra components for @benjeau/react-native-draw Canvas component

Downloads

102

Readme

@benjeau/react-native-draw-extras

NPM badge CircleCI Status Platform badge

Extra components to complement @benjeau/react-native-draw:

  • CanvasControls
    • Clear drawing
    • Undo last path
    • Includes the BrushPreview component
    • Toggle between drawing and erasing
    • Toggle visibility of BrushProperties
  • BrushPreview
    • Displays an SVG preview of the stroke (color, thickness, opacity)
  • BrushProperties
    • Includes the ColorPicker component
    • Slider to change brush opacity
    • Slider to change brush size
  • ColorPicker
    • Grid of color where the user can select a color

Installation

npm install @benjeau/react-native-draw-extras
# or
yarn add @benjeau/react-native-draw-extras

Also, you need to install @react-native-community/slider and react-native-svg, and follow their installation instructions.

Example

Please see the example Expo application showcasing the components

Props

CanvasControls

Contains all the props of BrushProperties and the following:

| name | description | type | default | | ------------------------- | ---------------------------------------------------- | ---------------------- | --------- | | onClear | Callback when the clear button is pressed | () => void | - | | onUndo | Callback when the undo button is pressed | () => void | - | | onToggleEraser | Callback when the eraser button is pressed | () => void | - | | onToggleBrushProperties | Callback when the brush properties button is pressed | () => void | - | | buttonStyle | Override the style of the buttons | StyleProp<ViewStyle> | - | | tool | Initial tool of the canvas | brush or eraser | - | | deleteButtonColor | Delete button color | string | #81090A | | otherButtonsColor | Other buttons color (undo and eraser mode toggle) | string | #DDD |

BrushPreview

| name | description | type | default | | -------------- | ----------------------------------------------------- | --------------------------- | ------------ | | color | Color of the brush strokes | string | - (required) | | thickness | Thickness of the brush strokes | number | - (required) | | opacity | Opacity of the brush strokes | number | - (required) | | brushPreview | Brush preview preset, for different kinds of previews | stroke or dot or none | - (required) |

BrushProperties

Contains all the props of ColorPicker and the following:

| name | description | type | default | | ------------------- | --------------------------------------------------------------------------------------------------- | -------------------------------- | ------- | | thickness | Thickness of the brush strokes | number | 3 | | opacity | Opacity of the brush strokes | number | 1 | | onThicknessChange | Callback when brush size is changed via the slider | (newThickness: number) => void | - | | onOpacityChange | Callback when brush opacity is changed via the slider | (newOpacity: number) => void | - | | opacityStep | Step value of the opacity slider, should be between 0 and 1 | number | 0.1 | | thicknessMin | Minimum value of the thickness slider | number | 5 | | thicknessMax | Maximum value of the thickness slider | number | 35 | | thicknessStep | Step value of the thickness slider, should be between props.thicknessMin and props.thicknessMax | number | 1 | | sliderColor | Slider color | string | #000 | | style | Style of the container | StyleProp<ViewStyle> | - |

ColorPicker

| name | description | type | default | | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | -------------------------------------- | | color | Brush color, one from the colors provided | string | - (required) | | onColorChange | Callback when a color is selected | (newColor: string) => void | - (required) | | colors | Color picker colors, specifying the color picker sections each containing rows of colors. First array defines the sections, second one defines the rows, and the last one defines the columns. | string[][][] | DEFAULT_COLORS | | style | Style of the container | StyleProp<ViewStyle> | - |

Helper functions

  • If you want to know if a color is bright or not, isBright() is available to detect if a HEX color is bright or dark.

Contributing

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

License

MIT